Repository navigation
how to rerun a model with different vairable values #5659
Replies: 2 comments
|
i think i have figured that out, it looks like the variables need to be defined in the config.gateways block and have to then be overriden with SQLMESH__GATEWAYS__gatewayname__VARAIABLES__variablename is it possible to make those env variables independent from the gateway name without having to use env_var jinja inside the config.yaml file ? ALSO another question: is it possible to get the current --start and --end values as a sql macro ?? i dont mean the start_ts and end_ts of the incremental models, but only the start and end of the current run. |
|
The gateway is not required. Any # config.yaml
variables:
time_bucket: daySELECT @VAR('time_bucket', 'day') AS bucket -- @VAR is enough, no @DEF neededThe reason your first attempt seemed to do nothing is a different one: variables are rendered into the model when a plan is made, and the value is part of the model's fingerprint. I tested this on 0.236.4 with DuckDB: with If users should see several aggregations side by side, put each value in its own environment instead of flipping prod: On Windows cmd also watch out for |
Uh oh!
There was an error while loading. Please reload this page.
hi there, i am getting quite a bit confused on how variables are to be used in sqlmesh.
i have a somewhat complex model that uses variabels and incremental loading of some models. i also have views and full models that use some variables.
i want this variables to be overridable between different runs so that the user can get different aggregate views of the same raw data for example.
first question: how should i define the variables in the model:
and how can i override those variables at run time, i am trying like:
set SQLMESH__VARIABLES__TIME_BUCKET=day &
set SQLMESH__VARIABLES__AGGREGATION_DIMENSION=plant &
...venv\Scripts\activate & sqlmesh fetchdf "select * from telemetry_data_sqlmesh.kpi_report order by bucket desc limit 10;"
but that does not seem to have any real effect
All reactions