Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
Adding the encoding parameter to the connection string did do the trick. With this now my test code is running perfectly fine, rendering the results as expected. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provid

Re: [sqlalchemy] Advice for handling QueuePool limit exceptions (3o7r)

2020-05-06 Thread Mike Bayer
On Wed, May 6, 2020, at 11:24 AM, Colton Allen wrote: > Specifically: https://docs.sqlalchemy.org/en/13/errors.html#error-3o7r > > I think I've got a good handle on what the problem is. I just don't have the > experience to know how to solve it effectively and with confidence. > > Just some of

Re: [sqlalchemy] Adding extra constraints to monkey-patched model classes

2020-05-06 Thread Alejandro Avilés
Great, thank you. Managed to make it work! On Wednesday, May 6, 2020 at 2:35:12 PM UTC+2, Mike Bayer wrote: > > > > On Wed, May 6, 2020, at 7:19 AM, Alejandro Avilés wrote: > > I'm working on a project where I need to add additional columns to tables > defined in a different package. This is done

[sqlalchemy] Advice for handling QueuePool limit exceptions (3o7r)

2020-05-06 Thread Colton Allen
Specifically: https://docs.sqlalchemy.org/en/13/errors.html#error-3o7r I think I've got a good handle on what the problem is. I just don't have the experience to know how to solve it effectively and with confidence. Just some of my application's stats: - Postgres database hosted with Amazon RD

Re: [sqlalchemy] sqlalchemy list connections inside connection pool

2020-05-06 Thread Mike Bayer
the connection pool reuses connections, so when you "close" a connection, often it is recycled so that it is returned to its pooled store rather than being fully closed. Some background on this is at https://docs.sqlalchemy.org/en/13/glossary.html#term-released On Wed, May 6, 2020, at 8:45 A

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Mike Bayer
Alternatively, this will probably work as well, SQLAlchemy will pass it through to the client: create_engine("oracle+cx_oracle://user:pass@dsn/?encoding=utf-8") will update the docs now. >>> e = >>> create_engine("oracle+cx_oracle://scott:tiger@oracle1120/?encoding=utf-8") >>> e.dialect.create

Re: [sqlalchemy] sqlalchemy list connections inside connection pool

2020-05-06 Thread Oğuzhan Kaya
what is mean that checkedout checkedin connection and why When connection is closed connection in pool number increases? 5 Mayıs 2020 Salı 19:50:22 UTC+3 tarihinde Mike Bayer yazdı: > > engine.pool has some metrics on it: > > >>> from sqlalchemy import create_engine > >>> e = create_engine("mysql

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Mike Bayer
I see you are using an "encoding" on cx_Oracle connect(), which SQLAlchemy does not use; this parameter appears to be added to cx_Oracle only recently. The standard way to set Oracle encodings is via the NLS_LANG environment variable, please use this parameter when dealing with Oracle client lib

Re: [sqlalchemy] Adding extra constraints to monkey-patched model classes

2020-05-06 Thread Mike Bayer
On Wed, May 6, 2020, at 7:19 AM, Alejandro Avilés wrote: > I'm working on a project where I need to add additional columns to tables > defined in a different package. This is done via monkeypatching the model > classes. I need now to also add additional constraints, but I'm getting no > luck o

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
Engine object configuration - convert_unicode = False - cx_oracle_ver = (7, 3, 0) - driver = cx_oracle - encoding = UTF8 - nencoding = -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCV

[sqlalchemy] Adding extra constraints to monkey-patched model classes

2020-05-06 Thread Alejandro Avilés
I'm working on a project where I need to add additional columns to tables defined in a different package. This is done via monkeypatching the model classes. I need now to also add additional constraints, but I'm getting no luck overriding `__table_args__`. I'm a bit lost as to how to continue i

Re: [sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Simon King
What are the values of "encoding" and "nencoding" on the connection object? https://github.com/oracle/python-cx_Oracle/issues/36 https://stackoverflow.com/a/37600367/395053 You probably need to grab the raw dbapi connection: https://docs.sqlalchemy.org/en/13/core/connections.html#working-with-ra

[sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
## Traceback (most recent call last): File "/data/projects/Python/database/sqlalchemy/sqlalchemy_oracle.py", line 45, in df = pd.read_sql_query(u'SELECT owner, table_name FROM all_tables WHERE owner LIKE \'äöüßÄÖÜœ\'', co

[sqlalchemy] Re: SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
## Traceback (most recent call last): File "/data/projects/Python/database/sqlalchemy/sqlalchemy_oracle.py", line 45, in df = pd.read_sql_query(u'SELECT owner, table_name FROM all_tables WHERE owner LIKE \'äöüßÄÖÜœ\'', co

Re: [sqlalchemy] SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Simon King
It might help to display the stack trace when the encoding fails, so we can see exactly where the error is coming from. Simon On Wed, May 6, 2020 at 9:01 AM Anno Nühm wrote: > > I am currently engaged in evaluating SQLAlchemy for a new project. When > trying to execute queries containing non-as

Re: [sqlalchemy] generate top-level python code for an alembic revision from render_item

2020-05-06 Thread Adrian
Works great, thanks! -- 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

[sqlalchemy] SQLAlchemy: UnicodeEncodeError: 'ascii' codec can't encode characters (db engine encoding ignored?)

2020-05-06 Thread Anno Nühm
I am currently engaged in evaluating SQLAlchemy for a new project. When trying to execute queries containing non-ascii characters an exception is raised. The SQL statement used for carrying out the evaluation: SELECT owner, table_name FROM all_tables WHERE owner LIKE 'äöüßÄÖÜœ'; Executin