Pass a parameter to dbt from the command line

hi there,

I’m trying to run a “dbt run” command while passing a parameter (number of rows to return from a select query) to my .SQL file in model.
The command looks like "dbt run -mypara 100
Then in the SQL:
select * from table {if mypara !=‘’} limit mypara {endif}

Is it possible do that using default dbt? Thanks.

Yes, you can pass parameters to SQL models in DBT

dbt run --vars{“var”:“value”}

and use ‘var’ in SQL model


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.