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... On Mar 21, 2011, at 10:02 AM, ddarko wrote: > Python 3.1 > SQLAlchemy 0.6.6 (and tested with 0.7b3) > psycopg2 2.4 > postgresql 8.4 > > Has anyone tested this configuration? > > psycopg2 alone work for me great, but in spite of installing the > current version of SQLAlchemy accordance with the instructions > README.py3k connection is not working properly: > > print(db.execute("select count(*) from news;").fetchall()) > > > $ python _test_sqlalchemy.py > Traceback (most recent call last): > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 671, in _do_get > return self._pool.get(wait, self._timeout) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/util/queue.py", line 137, in get > raise Empty > sqlalchemy.util.queue.Empty > > During handling of the above exception, another exception occurred: > > Traceback (most recent call last): > File "_test_sqlalchemy.py", line 12, in <module> > print(db.execute("select count(*) from news;").fetchall()) > File "/home/..../lib/db_model.py", line 28, in execute > return dbs.execute(a) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/orm/scoping.py", line 113, in do > return getattr(self.registry(), name)(*args, **kwargs) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/orm/session.py", line 758, in execute > return self._connection_for_bind(bind, > close_with_result=True).execute( > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/orm/session.py", line 694, in > _connection_for_bind > return self.transaction._connection_for_bind(engine) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/orm/session.py", line 246, in > _connection_for_bind > conn = bind.contextual_connect() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 2062, in contextual_connect > self.pool.connect(), > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 208, in connect > return _ConnectionFairy(self).checkout() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 369, in __init__ > rec = self._connection_record = pool._do_get() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 693, in _do_get > con = self._create_connection() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 173, in _create_connection > return _ConnectionRecord(self) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/pool.py", line 257, in __init__ > pool.dispatch.first_connect.exec_once(self.connection, self) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/event.py", line 227, in exec_once > self(*args, **kw) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/event.py", line 236, in __call__ > fn(*args, **kw) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/strategies.py", line 162, in first_connect > dialect.initialize(c) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/dialects/postgresql/base.py", line 793, in > initialize > super(PGDialect, self).initialize(connection) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/default.py", line 171, in initialize > self._get_server_version_info(connection) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/dialects/postgresql/base.py", line 964, in > _get_server_version_info > v = connection.execute("select version()").scalar() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 1259, in execute > params) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 1436, in _execute_text > statement, parameters > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 1519, in _execute_context > result = context.get_result_proxy() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/dialects/postgresql/psycopg2.py", line 198, in > get_result_proxy > return base.ResultProxy(self) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 2420, in __init__ > self._init_metadata() > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 2427, in _init_metadata > self._metadata = ResultMetaData(self, metadata) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/engine/base.py", line 2283, in __init__ > colname = dialect._description_decoder(colname) > File "/usr/local/lib/python3.1/dist-packages/SQLAlchemy-0.7b3dev- > py3.1.egg/sqlalchemy/processors.py", line 69, in process > return decoder(value, errors)[0] > File "/usr/lib/python3.1/encodings/utf_8.py", line 16, in decode > return codecs.utf_8_decode(input, errors, True) > TypeError: must be bytes or buffer, not str > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to sqlalchemy@googlegroups.com. > To unsubscribe from this group, send email to > sqlalchemy+unsubscr...@googlegroups.com. > 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 sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.