-
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
Bug: Incorrect Column Name Quoting in Python Model Audit Queries #3621
Comments
I'm actually unsure if this is a bug or expected behavior. I get why one would expect your example to "just work", but I noticed that the prevalent pattern in all of our examples is to instantiate @tobymao what do you think? This report is legit -- we're using I thought about changing it to |
@georgesittas I got the example explicitly from the docs website. Didn't know there is another way. |
Ah, interesting, thanks for providing that context. |
Hey @rbreejen, I looked into this and I believe this behavior is expected– it's up to the user to provide the right values for each attribute (e.g. I will make sure to fix docs, thanks for flagging it. |
@georgesittas Makes sense! Thanks! |
Description
When using Python models in SQLMesh, column names in audit configurations are incorrectly handled during SQL generation. While SQL model audits work correctly (where columns are specified without quotes), Python model audits fail because the quoted column names in the Python configuration are not properly converted to SQL identifiers.
Current Behavior
In Python models like:
The generated SQL treats the column name as a string literal instead of a column identifier.
Expected Behavior
Example
Technical Details
The issue is specific to Python model definitions where column names are necessarily provided as Python strings. The string values aren't being properly converted to SQL identifiers during the audit query generation process.
Steps to Reproduce
The test should fail but actually succeeds!
Impact
Suggested Fix
Add proper column identifier conversion specifically for Python model audit configurations, ensuring that string column names are converted to proper SQL identifiers.
The text was updated successfully, but these errors were encountered: