We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Want to generate below query using pypika for postgresql.
select name, employee_id from employee where phone_no && ARRAY['7377','3877','9277']::varchar[]
How to create above query using pypika? Is there any way we can do that?
The text was updated successfully, but these errors were encountered:
So there is an Array object which when used with PostgreSQLQuery will give the ARRAY[...] syntax
Array
PostgreSQLQuery
from pypika import Field, Array from pypika.dialects import PostgreSQLQuery query = ( PostgreSQLQuery .from_("employee").select("name", "employee_id") .where(Array("7377", "3877", "9277")) )
which gets you some of the way
SELECT "name","employee_id" FROM "employee" WHERE ARRAY['7377','3877','9277']
I suspect the && will have to be built out like this class and the ::varchar[] will have to be built off of the Term class
EDIT: Try out the ArithmeticExpression for the && and build out custom operation like in #779
Sorry, something went wrong.
Hi @kalra19, were you able to find a solution or work around for this?
No as of now, but for a work around solution, i have used sql string composition to generate the query.
FYR: https://www.psycopg.org/docs/sql.html
No branches or pull requests
Want to generate below query using pypika for postgresql.
select name, employee_id from employee where phone_no && ARRAY['7377','3877','9277']::varchar[]
How to create above query using pypika? Is there any way we can do that?
The text was updated successfully, but these errors were encountered: