Update: I dropped down to psycopg2 and was finally able to get a query to go through doing the following:
conn = psycopg2.connect(**options) conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT) cur = conn.cursor() cur.execute("SELECT COUNT(*) FROM users;") print cur.fetchone() cur.close() conn.close() I noticed that in SA there isn't a ISOLATION_LEVEL_AUTOCOMMIT in the isolation lookup in the PGDialect_psycopg2 dialect. Is the best way to go forard to create my own dialect? thanks, Matt On Saturday, February 16, 2013 1:12:20 PM UTC-6, matt g wrote: > > After seeing the announcement for Amazon Redshift yesterday I thought I > would see how hard it's going to be to connect from psycopyg/SqlAlchemy. So > far I'm not having any luck. Below is what I'm trying and the error that > follows: > > engine = create_engine(URL('postgres', **options), poolclass=NullPool, > execution_options={'no_parameters': True}) > conn = engine.connect() > > Traceback (most recent call last): > File "redshift.py", line 14, in <module> > conn = engine.connect() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 2472, in connect > return self._connection_cls(self, **kwargs) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 878, in __init__ > self.__connection = connection or engine.raw_connection() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 2558, in raw_connection > return self.pool.unique_connection() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/pool.py", > line 183, in unique_connection > return _ConnectionFairy(self).checkout() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/pool.py", > line 387, in __init__ > rec = self._connection_record = pool._do_get() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/pool.py", > line 802, in _do_get > return self._create_connection() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/pool.py", > line 188, in _create_connection > return _ConnectionRecord(self) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/pool.py", > line 273, in __init__ > pool.dispatch.first_connect.exec_once(self.connection, self) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/event.py", > line 282, in exec_once > self(*args, **kw) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/event.py", > line 291, in __call__ > fn(*args, **kw) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", > > line 167, in first_connect > dialect.initialize(c) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.py", > > line 1000, in initialize > super(PGDialect, self).initialize(connection) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/default.py", > > line 171, in initialize > self._get_server_version_info(connection) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/dialects/postgresql/base.py", > > line 1184, in _get_server_version_info > v = connection.execute("select version()").scalar() > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 1449, in execute > params) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 1628, in _execute_text > statement, parameters > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 1698, in _execute_context > context) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/base.py", > > line 1685, in _execute_context > context) > File > "/Users/matt/envs/health/lib/python2.7/site-packages/sqlalchemy/engine/default.py", > > line 334, in do_execute_no_params > cursor.execute(statement) > sqlalchemy.exc.ProgrammingError: (ProgrammingError) permission denied to > set parameter "transaction_isolation" to "serializable" > 'select version()' {} > > Any ideas? > > thanks, > Matt > > > -- 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 post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.