[sqlalchemy] Re: Conditional Insert Rewrite (part 2)

2015-01-19 Thread Lycovian
TL;DR: I'm trying to rewrite a query to remove the column 'x' in the following query which is an numeric type column at execution time: or how to turn this: INSERT into 't' (id, x) VALUES (?, ?), (1, None) = INSERT into t (id) values (?), (1,) I have been able to remove the offending bind

[sqlalchemy] Re: Conditional Insert Rewrite (part 2)

2015-01-18 Thread Lycovian
Sorry but I don't see any parameters being sent to the before_execute listener. For this code: ... @event.listens_for(engine, before_execute, named=True) def before_execute(**kw): print ==BE ce: {}, mp: {}, p: {}.format(kw['clauseelement'], kw['multiparams'], kw['params']) ins =

[sqlalchemy] Re: Conditional Insert Rewrite (part 2)

2015-01-18 Thread Lycovian
Is it expected that before_execute only has the statement and no param values on a parameterized query? When I run the code below note that the ==BE line doesn't actually have the bind values available just the clauseelement appears to be populated. output ... *==BE ce: INSERT INTO