[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] Changing database credentials after engine creation

2020-06-16 Thread Venkata Siva Naga Tatikonda
Hello Everyone, 

Need some suggestion/insight on some use case we have:

We have python django web application which uses sqlalchemy v1.3.13 
(mysqldb) to communicate with AWS Aurora (RDS). This application uses AWS 
Secrets Manager for managing database credentials and utilizing sqlalchemy 
(w/ mysqldb & queuepool) to read user/password during application start-up 
via settings.py/manage.py. 

For security reasons, we have to rotate database credentials frequently and 
for that we are using AWS Lambda to update in the Aurora DB & secrets 
manager. We are using pool_recycle w/ 5 mins and also MYSQL database issues 
a disconnect if there is any connection is open & idle for more than 8 
hours, so when this happens and pool creates a new connection then it fails 
the authentication. We don't see anyway for engine object to 
reload/refresh/re-read updated credentials other than re-deploying or 
restarting our services for this issue.

Is there any documentation on how we could re-create/reload engine or other 
mechanisms to handle/address this situation ?


Thanks,
Pavan.

-- 
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/ed50fe16-f759-4d14-a111-62457f4009c5o%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.


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

2020-06-16 Thread Balukrishnan
Hi friends,

I am looking for function or operator which is equivalent to bit_or in 
PostgreSQL 
aggregate function 
. Is 
there any? I can't find any. Please help.

-- 
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/7768f86d-8d9b-4265-ab26-a12a07b1231ao%40googlegroups.com.


Re: [sqlalchemy] Connect to multiple Oracle DBs via LDAP

2020-06-16 Thread Syrrius78
oki thanks a lot. I'll send a message to the cx_Oracle devs.

-- 
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/ba988dba-000b-4c20-916c-bcfd85828bd4o%40googlegroups.com.


Re: [sqlalchemy] Connect to multiple Oracle DBs via LDAP

2020-06-16 Thread Mike Bayer
sounds like a cx_Oracle issue ? I don't really understand what this means. A 
particular Engine can only connect to one database at a time in any case. 
Contact cx_Oracle devs at https://github.com/oracle/python-cx_Oracle/issues 

Python doesn't support JDBC unless you're using Jython which SQLAlchemy isn't 
supporting right now.



On Tue, Jun 16, 2020, at 5:15 AM, Syrrius78 wrote:
> hi,
> 
> i'm using sqlalchemy 1.3.12.
> For a project, I try to connect to multiple oracle databases via LDAP 
> (different LDAP url & context) .
> 
> it's working fine for 1 database : cx_Oracle dialect + sqlnet.ora & ldap.ora 
> files.
> 
> Problem with this method : it seems we can declare only 1 database 
> (impossible to declare multiple LDAP context)
> 
> Does someone have an idea how to do that ?
> 
> OR
> 
> maybe there is a way to do JDBC connection with SQLAlchemy ?
> 
> thanks in advance for your help.
> 

> --
>  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/d37e6923-be55-49ad-9cda-864823373ecfo%40googlegroups.com
>  
> .

-- 
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/617f2bdc-862c-448b-8b91-f1fd071b7184%40www.fastmail.com.


[sqlalchemy] Connect to multiple Oracle DBs via LDAP

2020-06-16 Thread Syrrius78
hi,

i'm using sqlalchemy 1.3.12.
For a project, I try to connect to multiple oracle databases via LDAP 
(different LDAP url & context) .

it's working fine for 1 database : cx_Oracle dialect + sqlnet.ora & 
ldap.ora files.

Problem with this method : it seems we can declare only 1 database 
(impossible to declare multiple LDAP context)

Does someone have an idea how to do that ?

OR

maybe there is a way to do JDBC connection with SQLAlchemy ?

thanks in advance for your help.

-- 
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/d37e6923-be55-49ad-9cda-864823373ecfo%40googlegroups.com.