Learn how to include code from another query
{ref ('other_query')}
, where other_query
is the name of another .sql
file located in the /queries
folder. This syntax imports the raw SQL code from the specified file to the location where it is added.
queries/users/query.sql
and you want to reference /queries/users/orders
query:
/
prefix. This means the path of the query is resolved from the root of queries folder.
Following the previous example, you can reference /queries/users/orders
query as follows:
queries
folder doesn’t need to be included in the path. Also .sql
is optional. You can add if you want