Trying to make insert query:
q_stat_insert = Stat.__table__.insert().values(insert_values)
res = Session.connection().execute(q_stat_insert, params)
but I have trigger on that table that returns NULL, how can I turn off RETURNING functionality?
Previously I've been avoiding this by simply using __table_args__ = ({'implicit_returning': False}) in my class declaration.
P.S. I'm using Postgresql 9.4 and SQLAlchemy 0.9.8
INSERT statements have an inline parameter which, when set to True, stops the implicit returning for a given statement. Set this parameter inline = True within your insertion statement to turn off the implicit return. It's worth noting that the default parameter scheme for an insert statement looks like this, which is why you must set inline=True:
sqlalchemy.sql.expression.insert(table, values=None, inline=False,
bind=None, prefixes=None, returning=None, return_defaults=False, **dialect_kw)
This is documented here for 0.9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With