On 06/28/2016 09:09 AM, Martijn van Oosterhout wrote:
On 27 June 2016 at 16:22, Mike Bayer <mike...@zzzcomputing.com
<mailto:mike...@zzzcomputing.com>> wrote:
Not really sure, that URL itself won't allow a psycopg2 connection
to even occur.
Yeah, I noticed that. psql has sensible defaults here that psycopg2
apparently doesn't have. In this case I'd just stripped the credentials
out of the script, sorry.
The error means that the construct is trying to be generated as a
string, like in a print statement. But 1.1 has a new feature that
allows default stringification of pg.ARRAY and other constructs to
actually work.
Need a stack trace at the very least.
Good point. Attached. Just to get some more information I put stopped a
debugger at the raise statement and got the following:
/home/martijn/virtualenv/eggs/SQLAlchemy-1.1.0b1-py2.7-linux-x86_64.egg/sqlalchemy/ext/compiler.py(459)__call__()
-> raise exc.CompileError(
(Pdb) l
454 if not fn:
455 try:
456 fn = self.specs['default']
457 except KeyError:
458 import pdb; pdb.set_trace()
459 -> raise exc.CompileError(
460 "%s construct has no default "
461 "compilation handler." % type(element))
462 return fn(element, compiler, **kw)
[EOF]
(Pdb) p locals()
{'self': <sqlalchemy.ext.compiler._dispatcher object at 0x7f90e8806910>,
'element': ARRAY(String()),
'kw': {'type_expression': Column('reference', ARRAY(String()),
table=<test>, primary_key=True, nullable=False,
server_default=DefaultClause('{}', for_update=False))},
'pdb': <module 'pdb' from '/usr/lib/python2.7/pdb.pyc'>,
'fn': None,
'compiler': <sqlalchemy.dialects.postgresql.base.PGTypeCompiler object
at 0x7f90e676b1d0>}
(Pdb) p self.specs
{'sqlite': <function compile_binary_sqlite at 0x7f90e880c7d0>}
(Pdb) p self.specs['default']
*** KeyError: KeyError('default',)
That sqlite reference looks a bit weird, did I miss some initialisation
somewhere?
It looks like the @compiles system is in place, which SQLAlchemy does
not use internally. that wasn't in your code example but that's likely
where the exception is raised from.
Hope this helps,
--
Martijn van Oosterhout <klep...@gmail.com <mailto:klep...@gmail.com>>
http://svana.org/kleptog/
--
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
<mailto:sqlalchemy+unsubscr...@googlegroups.com>.
To post to this group, send email to sqlalchemy@googlegroups.com
<mailto:sqlalchemy@googlegroups.com>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.
--
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.