[Sqlalchemy-tickets] Issue #3929: Ability to print/compile OnConflictDoUpdate statement (zzzeek/sql
Brought to you by:
zzzeek
From: ER <iss...@bi...> - 2017-03-04 21:39:28
|
New issue 3929: Ability to print/compile OnConflictDoUpdate statement https://bitbucket.org/zzzeek/sqlalchemy/issues/3929/ability-to-print-compile ER: Dear all, I am using the OnConflictDoUpdate functionality of PostgreSQL, but I have troubles printing SQL statements (for debugging/ understanding). Is there something special to do to print these statements that are specific to PostgreSQL ? Of course, when I execute the query it works very well. ``` #!python insert_stmt = insert(table).from_select(select_stmt.columns, select_stmt) upsert_stmt = insert_stmt.on_conflict_do_update( constraint=table.primary_key, set_={fieldName: insert_stmt.excluded[fieldName]} ) print str(upsert_stmt) # error print str(upsert_stmt.compile(dialect='postgresql')) # error ``` Here is the error : UnsupportedCompilationError: Compiler <sqlalchemy.sql.compiler.StrSQLCompiler object at 0x7f5b22460a90> can't render element of type <class 'sqlalchemy.dialects.postgresql.dml.OnConflictDoUpdate'> Thanks a lot |