-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Support top level properties in model_defaults #3696
base: main
Are you sure you want to change the base?
Conversation
@@ -40,6 +40,7 @@ Configuration options for SQLMesh model properties. Supported by all model kinds | |||
| `gateway` | Specifies the gateway to use for the execution of this model. When not specified, the default gateway is used. | str | N | | |||
| `optimize_query` | Whether the model's query should be optimized. This attribute is `true` by default. Setting it to `false` causes SQLMesh to disable query canonicalization & simplification. This should be turned off only if the optimized query leads to errors such as surpassing text limit. | bool | N | | |||
| `validate_query` | `validate_query` | Whether the model's query will be strictly validated at compile time. This attribute is `false` by default. Setting it to `true` causes SQLMesh to raise an error instead of emitting warnings. This will display invalid columns in your SQL statements along with models containing `SELECT *` that cannot be automatically expanded to list out all columns. | bool | N | | |||
|
|||
### Model defaults |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might want to add a note somewhere in the docs about how to un-set a default at the model level.
It looks like this is supported by defining the property as None
at the model level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes good point, added an explanation and an example to make it clear how to unset a property
dce784a
to
1154b8e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just one comment.
session_properties[k] = exp.Literal.string(k).eq(v) | ||
if k not in properties: | ||
properties[k] = exp.Literal.string(k).eq(v) | ||
elif properties[k].expression.sql().lower() in {"none", "null"}: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is matching null
here safe? Can that be an actual property value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to match for python models properties where None
will be null
here
This update extends the support for top-level properties to be enabled project wide, fixes: #3599
Don't know if it makes sense to include more, as the others seem quite model-specific, but I’m happy to add them if anyone feels they’re necessary.