Skip to content
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

Support tuples in filters #988

Open
marpulli opened this issue Jan 18, 2023 · 0 comments
Open

Support tuples in filters #988

marpulli opened this issue Jan 18, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@marpulli
Copy link

Is your feature request related to a problem? Please describe.
I would like to add a filter to my query that uses a tuple. E.g. the generated SQL would look something like:

SELECT id FROM employees
WHERE (first_name, id) > (:first_name, :id)
ORDER BY (first_name, id)
LIMIT 10

Describe the solution you'd like
I think sqlalchemy uses the following syntax, which would work:

filter(tuple_("first_name", "id") > tuple_(first_name, id))

Describe alternatives you've considered
The query can also be written with a combination of AND/OR statements but this does not seem to make use of a multi-column index on (first_name, id) (we are using postgres), meaning it has worse performance.

Additional context

@marpulli marpulli added the enhancement New feature or request label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant