Re: [sqlalchemy] Re: Python 3.1 + SQLAlchemy 0.6 or 0.7
On Mar 30, 2011, at 1:39 PM, Hans-Martin wrote: > On Mar 30, 7:13 pm, Michael Bayer wrote: >> well its not going to work there either most likely since we don't support >> connecting without a hostname, probably. You can't put "localhost" in there >> ? > > Doesn't work either, same error. Adding my system username (and > password) then throws errors from the Postgres backend. > > I also installed pg8000 for the 0.6.6 + Py 2.7 setup and this gives > the same error. With psycopg2, it works. Is there a reason that it > would stop doing so in 3.2? OK so its some artifact of the pg8000 dialect. its nothing Python 3 related. > > -- > 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.
Re: [sqlalchemy] Re: Python 3.1 + SQLAlchemy 0.6 or 0.7
well its not going to work there either most likely since we don't support connecting without a hostname, probably. You can't put "localhost" in there ? On Mar 30, 2011, at 1:07 PM, Hans-Martin wrote: >> you'd need an @ sign in there perhaps: >> >> db://@/test > > Same error. But no big deal, I can wait for psycopg2 support in Python > 3.2. > > -- > 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.
Re: [sqlalchemy] Re: Python 3.1 + SQLAlchemy 0.6 or 0.7
On Mar 30, 2011, at 12:42 PM, Hans-Martin wrote: > On Mar 30, 5:43 pm, Michael Bayer wrote: >> That's not an error I'm familiar with how to reproduce; it suggests an >> incorrect string passed to create_engine(). Working code with Python 3.2 >> plus pg8000 looks like: >> >> from sqlalchemy import create_engine >> >> e = create_engine("postgresql+pg8000://scott:tiger@localhost/test") >> print(e.execute("select 1").scalar()) > > That might be it -- I have the Postgres installation set up to work > with 'ident sameuser' authentication, so after > > e = create_engine("postgresql+pg8000:///test") > > I get the same error as before. you'd need an @ sign in there perhaps: db://@/test > > -- > 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.
Re: [sqlalchemy] Re: Python 3.1 + SQLAlchemy 0.6 or 0.7
That's not an error I'm familiar with how to reproduce; it suggests an incorrect string passed to create_engine(). Working code with Python 3.2 plus pg8000 looks like: from sqlalchemy import create_engine e = create_engine("postgresql+pg8000://scott:tiger@localhost/test") print(e.execute("select 1").scalar()) Note that we're at 99.7% test success for Python 3.2 + pg8000, there's only 8 failures which are basically platform-dependent issues with the tests themselves: http://paste.pocoo.org/show/362703/ On Mar 30, 2011, at 11:13 AM, Hans-Martin wrote: > Sorry, I was not expecting it to work, just trying to follow your > suggestion. > > SQLAlchemy Dev snapshot + pg8000 from > http://pybrary.net/pg8000/dist/pg8000-py3-1.08.tar.gz > throws this error: > > Traceback (most recent call last): > File "set_meta_info_levels_0_1.py", line 60, in >set_up_schemata() > File " src/library/db_connect.py", line 64, in set_up_schemata >if s not in existing_schemata(): > 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 254, in __init__ >self.connection = self.__connect() > File " lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/ > sqlalchemy/pool.py", line 314, in __connect >connection = self.__pool._creator() > File " lib/python3.2/site-packages/SQLAlchemy-0.7b4dev-py3.2.egg/ > sqlalchemy/engine/strategies.py", line 84, in connect >e, dialect.dbapi.Error) from e > sqlalchemy.exc.DBAPIError: (TypeError) connect() takes at least 1 > argument (1 given) None None > > > I have a working setup with 2.7 + 0.6.6, but would like to port it to > 3.2 relatively soon -- if I can help trying out things, just let me > know. > > Best wishes, > Hans-Martin > > -- > 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.
Re: [sqlalchemy] Re: Python 3.1 + SQLAlchemy 0.6 or 0.7
On Mar 30, 2011, at 8:31 AM, Hans-Martin wrote: >> On Mar 21, 3:31 pm, Michael Bayer 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 2