Re: [sqlalchemy] Re: Bulk insert creating duplicate primary-keys

2019-06-12 Thread Mike Bayer
what's the default on the column? seems like that's the problem here. if this is an in-SQLAlchemy default, that won't work, you need to generate the uuids on the database side if you are using a SELECT. The functions are available through an extension on PG, there's background here:

[sqlalchemy] Re: Bulk insert creating duplicate primary-keys

2019-06-12 Thread Colton Allen
Also, I should mention the ID is not explicitly mentioned in the select query. I am relying on the column's "default" argument to supply the UUID. Also also, I made a typo. It should read "when the select only finds one row". On Wednesday, June 12, 2019 at 12:36:50 PM UTC-7, Colton Allen

[sqlalchemy] Bulk insert creating duplicate primary-keys

2019-06-12 Thread Colton Allen
I'm using Postgres and I am getting a duplicate primary key error when attempting to insert from a query. My primary key is a UUID type. statement = insert(my_table).from_select(['a', 'b'], select([sometable.c.a, sometable.c.b]) session.execute(statement) session.commit() Error: "DETAIL:

Re: [sqlalchemy] inheritance hierarchy not updating second level hierarchy

2019-06-12 Thread Mike Bayer
On Wed, Jun 12, 2019, at 10:10 AM, Javier Martínez wrote: > Hi everyone, > I am searching but I find no solution for my issue that is why I decided to > ask here. Thanks in advance for your attention. > > The issue is related to the update of a second level hierarchy object Id. I > am

[sqlalchemy] inheritance hierarchy not updating second level hierarchy

2019-06-12 Thread Javier Martínez
Hi everyone, I am searching but I find no solution for my issue that is why I decided to ask here. Thanks in advance for your attention. The issue is related to the update of a second level hierarchy object Id. I am creating a hierarchy, following the recommendations in the tutorials but I