I see you already looked into it. Thanks!
W dniu środa, 28 września 2016 20:55:05 UTC+2 użytkownik Mike Bayer napisał:
>
> this is likely use cases that have been untested, if you can file this
> w/ a complete test case as a bug report on bitbucket we can start
> looking into it.
>
>
> On 09/28/2016 12:05 PM, Paweł Szynkiewicz wrote:
> > Hello all
> >
> > SA: 1.1.0b3
> > db: postgresql 9.5
> >
> > I have a problem with method on_conflict_do_update for pg specific
> insert.
> > Precisely with the where argument. It looks like wrong SQL statement is
> > generated.
> >
> > example:
> >
> > class Foo(Base):
> > ...
> > bar = Column(Integer)
> >
> > insert_stmt = insert(Foo)
> >
> > on_update_stmt = insert_stmt.on_conflict_do_update(
> > set_=dict(
> > bar=insert_stmt.excluded.bar,
> > ),
> > where=(Foo.bar < insert_stmt.excluded.bar)
> > )
> >
> > session.execute(on_update_stmt, data)
> >
> > it gives error and rightly so:
> >> column reference "bar" is ambiguous
> >
> > SQL looks like that:
> >
> > SQL: 'INSERT INTO foo (...) VALUES (...) ON CONFLICT (...) DO UPDATE SET
> > bar = excluded.bar WHERE bar < bar'
> >
> > WHERE clause is not expanded properly, the alias EXCLUDED is omitted. Is
> > this a bug or I'm doing sht wrong?
> >
> > the workaround I use is:
> >
> > ...
> > where=(text('foo.bar < EXCLUDED.bar'))
> > ...
> >
> > Cheers
> >
> >
> >
> > --
> > 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 [email protected] <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > To post to this group, send email to [email protected]
> <javascript:>
> > <mailto:[email protected] <javascript:>>.
> > 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.