-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
FINAL statement not working #231
Comments
I'm not sqlalchemy dev and my code is filthy, but it fixes FINAL and other flags in ORM engine. The problem is that after compiling SQL (only if ORM is used) it creates new Select statement and not copy attributes from original one. I've overloaded 2 methods and add copy from old Select to new all needed attributes. Maybe it could be done in a more elegant way. |
In my project we had to patch clickhouse dialect so it propagates FINAL to the sql queries. Seems like it's working. @xzkostyan would it make too much hassle to merge aforementioned PR? |
Describe the bug
I'm using
.final()
but there are no changes in query.Code:
Then I'm compiling query:
And got
SELECT
query without FINAL.I've quickly check debugger, it seems that Query class is from lib, but select statement in it not. When I call
.final()
in query it works correctly (set final flag in class to True), but insqlcompiler
final_clause = getattr(select, '_final_clause', None)
returnsNone
I've also tried to catch
_compile_context
call, but it seems that it's not calling. Maybe I do something wrong?I've figured out that I can compile it in the right way:
But actual query that will be sent to clickhouse (when iterate over
qs
) will not containFINAL
.Versions
Latest version from git
The text was updated successfully, but these errors were encountered: