[sqlalchemy] Re: Can't find anything equivalent to bit_or in PostgreSQL

2020-06-16 Thread Balukrishnan
Thank you very much. I tried that and it is working perfectly for me.

On Wednesday, June 17, 2020 at 3:12:04 AM UTC+5:30, Jonathan Vanasco wrote:
>
> If this just needs this to be rendered for PostgreSQL, you can use the 
> `func` generator:
>
>
> https://docs.sqlalchemy.org/en/13/core/sqlelement.html#sqlalchemy.sql.expression.func
>
> from sqlalchemy.sql.expression import func 
>
> query = session.query(Foo).filter(func.bit_or(Foo.cola, Foo.colb)...
>
>
> `func` is a special namespace and will render UNKNOWN functions as you 
> invoke them.
>
> This simple solution to render the correct sql works for most people.
>
> If you have more specific needs, such as using this within python 
> comparisons, you will need to read the docs on Custom types (
> https://docs.sqlalchemy.org/en/13/core/custom_types.html); if you need 
> this to work on multiple different databases you may have to write a custom 
> compiler for each supported one (
> https://docs.sqlalchemy.org/en/13/core/compiler.html 
> 
> )
>
>
>
>
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/99c50704-95be-4ccc-9e4b-c606e2e890fdo%40googlegroups.com.


[sqlalchemy] Re: Can't find anything equivalent to bit_or in PostgreSQL

2020-06-16 Thread 'Jonathan Vanasco' via sqlalchemy
If this just needs this to be rendered for PostgreSQL, you can use the 
`func` generator:

https://docs.sqlalchemy.org/en/13/core/sqlelement.html#sqlalchemy.sql.expression.func

from sqlalchemy.sql.expression import func 

query = session.query(Foo).filter(func.bit_or(Foo.cola, Foo.colb)...


`func` is a special namespace and will render UNKNOWN functions as you 
invoke them.

This simple solution to render the correct sql works for most people.

If you have more specific needs, such as using this within python 
comparisons, you will need to read the docs on Custom types (
https://docs.sqlalchemy.org/en/13/core/custom_types.html); if you need this 
to work on multiple different databases you may have to write a custom 
compiler for each supported one (
https://docs.sqlalchemy.org/en/13/core/compiler.html 

)




-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/9263259a-8c8c-4fff-b915-86f6106665c4o%40googlegroups.com.