Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Opensolr Search 4.5.0 Minor update available for module opensolr_search (4.5.0). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Views SQL Twig Fields

35 sites Security covered Drupal 8–11 Views ecosystem
View on drupal.org

This module allows you to use SQL expressions within Drupal Views for fields, filters, sorts, and arguments. It leverages Twig templating for more powerful and flexible custom queries, enabling complex computations and direct SQL input.

This module uses twig to support SQL expressions for fields, filters, sorts and arguments. Users can also enter SQL expressions directly. Twig support allow more powerful computation to be performed. It can also be used to provide raw SQL expressions.

SQL Support

This project supports SQL customized:

  • Fields
  • Filters
  • Sorts
  • Arguments
  • Relationships (using an optional module)

Notes

Use of Twig and SQL provides more flexibility but it requires an understanding of both to be used effectively. It is relatively easy to implement simple extensions such as aggregating/summing a Twig SQL field that compares another field to some value such as a cost greater than 100. Some checks are provided to limit any problems and assist in debugging but it is good practice to keep backups of a view before and after adding SQL changes. You have been warned.

Depends on

Dependencies of the latest stable release

  • views Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Feb 2026
Latest release
6 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Slowing

Releases

Version Type Core Release date
1.1.1 Stable 8–11 Feb 11, 2026