On Mar 30, 2011, at 8:31 AM, Hans-Martin wrote:

>> On Mar 21, 3:31 pm, Michael Bayer <[email protected]> wrote:
>> 
>>> Yeah psycopg2 with python 3 / sqlalchemy is not supported yet.  The python 
>>> 3 supported version of psycopg2 came out like, in the past two weeks.    It 
>>> will be 0.7 where its supported at all, hopefully soon as its a matter of 
>>> setting up some flags in the dialects.     In the meantime if you want to 
>>> start working with pg + SQLA + py3k you can try the python 3 version of 
>>> pg8000 - its not as nice or anywhere near as fast as psycopg2 but it works 
>>> in at least a rudimentary fashion.
>> 
>>> Also Python 3.2 is the latest version of py3k and actually has some fairly 
>>> dramatic behavioral differences vs. 3.1.   If you want to work with 3.2 and 
>>> let us know what quirks you find...
> 
> Below is one (Python 3.2, sqlalchemy 0.7b4 (downloaded snapshot 10min
> ago), Debian). Best wishes, Hans-Martin

As I said, psycopg2 does not work *at all* yet, with SQLAlchemy plus any Python 
3 version - the dialect has not been ported, so the issue below is just a 
rudimentary Python 3 issue.   You'd need to use pg8000 for the time being, 
which was ported at least a year ago.




> 
> Traceback (most recent call last):
>  File "src/library/db_connect.py", line 60, in existing_schemata
>    tmp = session.execute("""SELECT schema_name from
> information_schema.schemata;""")
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/orm/session.py", line 758, in execute
>    return self._connection_for_bind(bind,
> close_with_result=True).execute(
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/orm/session.py", line 694, in _connection_for_bind
>    return self.transaction._connection_for_bind(engine)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/orm/session.py", line 246, in _connection_for_bind
>    conn = bind.contextual_connect()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 2062, in contextual_connect
>    self.pool.connect(),
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/pool.py", line 208, in connect
>    return _ConnectionFairy(self).checkout()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/pool.py", line 369, in __init__
>    rec = self._connection_record = pool._do_get()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/pool.py", line 695, in _do_get
>    con = self._create_connection()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/pool.py", line 173, in _create_connection
>    return _ConnectionRecord(self)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/pool.py", line 257, in __init__
>    pool.dispatch.first_connect.exec_once(self.connection, self)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/event.py", line 227, in exec_once
>    self(*args, **kw)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/event.py", line 236, in __call__
>    fn(*args, **kw)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/strategies.py", line 162, in first_connect
>    dialect.initialize(c)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/dialects/postgresql/base.py", line 793, in initialize
>    super(PGDialect, self).initialize(connection)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/default.py", line 171, in initialize
>    self._get_server_version_info(connection)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/dialects/postgresql/base.py", line 964, in
> _get_server_version_info
>    v = connection.execute("select version()").scalar()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 1259, in execute
>    params)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 1436, in _execute_text
>    statement, parameters
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 1519, in _execute_context
>    result = context.get_result_proxy()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/dialects/postgresql/psycopg2.py", line 198, in
> get_result_proxy
>    return base.ResultProxy(self)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 2420, in __init__
>    self._init_metadata()
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 2427, in _init_metadata
>    self._metadata = ResultMetaData(self, metadata)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/engine/base.py", line 2283, in __init__
>    colname = dialect._description_decoder(colname)
>  File "lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/
> sqlalchemy/processors.py", line 69, in process
>    return decoder(value, errors)[0]
>  File "lib/python3.2/encodings/utf_8.py", line 16, in decode
>    return codecs.utf_8_decode(input, errors, True)
> TypeError: 'str' does not support the buffer interface
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to