-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Join support for sqlalchemy core api #35
Comments
Hi. Can you provide minimal example of query that should work? Now joins work only if you use session than provides following query attribute ( |
Example:
|
Well, the thing is You can try to use from sqlalchemy import join as generic_join
def join(left, right, onclause=None, isouter=False, full=False, *kwargs):
global_ = kwargs.pop('global_', False)
any_ = kwargs.pop('any', None)
all_ = kwargs.pop('all', None)
j = generic_join(left, right, onclause=onclause, isouter=isouter, full=full)
j.any = any_
j.all = all_
j.global_ = global_
return j |
After running your new join, the old code gives the same Error:
So I changed it a bit, without using classs method 'join', but now another Error shows up:
|
Oh, I see. Join here is method of the query constructed by select, not imported from sqlalchemy package. As dirty-dirty hack you can patch select result before join.
May be there is more elegant way to use patched version of join. |
I've done that feature and ready to make PR but got a question. I found that declarative join parameners much more convenient than standard sqlalchemy joins. Examples are here. Is it ok? Or do you want to save standard mechanism with several join arguments? In that case it will be several parameters for joins: isouter (bool), isfull (bool), isright (bool), any (bool), all (bool), global (bool), iscross (bool). There is another way: provide the both mechanisms: sqla-standard and declarative (like in my examples). |
I think that the second way is better (with both mechanisms: sqla-standard and declarative). There are many tools that use SA to generate SQL. If we want make these tools ClickHouse compatible sqlalchemy standard is required. But declarative way is more elegant. |
@AcLr I'm using your patch for join. The expected text should be @xzkostyan Is it still the case that "# Columns prefixed with table name are not supported" ? |
Awesome! Thanks a lot! |
Hi, it seems the current join support is only applied for orm api. I'm using sqlalchemy core api to do some query-generation task, and I need to use join in my querys. But I always get this error in drivers/base.py:
Could you add support for core api queries? Thx!
The text was updated successfully, but these errors were encountered: