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:  Key (id)=(f6bdf0e7-f2af-4f29-8122-5320e1ab428e) already 
exists."

This query runs successfully when the select on finds one row.  If there 
are more it fails.  Is there a way to instruct the query to generate a UUID 
for each row found?

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/36798ea6-8fa3-42d9-822d-c70dffe21b48%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to