DataGrip
 
Get DataGrip

Context live templates

Last modified: 11 October 2024

Context live templates is a solution for anyone who wants to generate simple statements straight from the Database Explorer. While live templates cover many cases where you need to write a simple query, context live templates take into account the context of the database explorer and the data source that you are using.

In the following animation, we use the Select first N rows from a table context live template for PostgreSQL, Microsoft SQL Server, and SQLite. Depending on a table of a data source, DataGrip generates different queries.

In contrast to regular live templates, context live templates use dbObjectName and dbColumns expressions for template variables and are applied to the Any SQL Statement context. For more information about template variables, refer to Live template variables.