Re: [sqlalchemy] How to ignore primary key errors on insert

2018-08-21 Thread Jonathan Vanasco
There's also the strategy of doing something within a nested transaction, which will allow you to rollback on an integrity error. such as... try: with s.begin_nested(): # do stuff s.flush() # this will trigger an integrity error, unless the fkey checks are deferred except

Re: [sqlalchemy] Remote side backpopulates

2018-08-21 Thread Mike Bayer
On Tue, Aug 21, 2018 at 12:47 PM, Alex Rothberg wrote: > Is there any way to declare a "remote side" backpopulates? i.e. where I > declare a relationship on class A to appear only on class B? I would like > the relationship only to be available on the remote class but I do not want > to / cannot

[sqlalchemy] Remote side backpopulates

2018-08-21 Thread Alex Rothberg
Is there any way to declare a "remote side" backpopulates? i.e. where I declare a relationship on class A to appear only on class B? I would like the relationship only to be available on the remote class but I do not want to / cannot modify the code for the remote class. For example: class

Re: [sqlalchemy] How to ignore primary key errors on insert

2018-08-21 Thread Simon King
If you are using SQLAlchemy core, there's this: http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#insert-on-conflict-upsert Does that meet your needs? Simon On Tue, Aug 21, 2018 at 3:36 AM Hardik Sanghavi wrote: > > Did this get resolved or are we to still ignore it > > > On