On Sunday, January 7, 2018 at 12:07:13 AM UTC+1, Mike Bayer wrote:
>
> 1. will you always use sequences? 
>

No, my dialect tries to use sequences only when the are explicitly 
specified, otherwise it tries to use SERIAL. So:

Column('id', Integer, Sequence('some_id_seq'), primary_key=True) uses & 
creates a sequence
Column('id', Integer, primary_key=True, autoincrement=True) uses SERIAL

2. are the sequences part of a database-side implicit system like PG 
> SERIAL or SQL Server IDENTITY or do they need to be explicitly 
> rendered like on Oracle? 
>

They are both. Like in Postgresql you can have SERIAL which creates an 
implicit sequence where I do not know the name for it. But I can also use 
named sequences instead of a SERIAL column. What I cannot do is to set a 
server side default value for columns with an explicit sequence to be 
table_seq.NEXTVAL; I have to explicitly pass it in the query (Just like in 
Oracle).

3. does your database support RETURNING? 
>

No

4. does your database support some kind of "fetch last id" function 
> that you run after an INSERT statement? 
>

Yes, I can run "SELECT DBINFO('sqlca.sqlerrd1') FROM 
sysmaster:"informix".sysdual" to retrieve the inserted serial after an 
insert.

5. does your DBAPI provide #4 as cursor.lastrowid or not? 
>

No

>From looking at the current test results, if I specify an explicit sequence 
everything behaves properly as of now. Ie the dialect issue a "SELECT 
seq.NEXTVAL FROM sysdual" and then uses that for inserts, the only thing 
where it seems to fail currently is Integer primary key with autoincrement.

I'll look into mssql's ExecutinContext pre_exec/post_exec and 
postfetch_lastrowid more extensively this evening. That said, I am happy 
for every further advice.

Thank you for the long explanation!

Cheers,
Florian

>From 

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to