For databases like Postgres, this works well because the database determines whether or not to fetch a new sequence value by looking at the insert values, and if the sequence value to insert is null, a new ID is created and used. So for a table with two SERIAL columns, the user could conceivably specify a value for one, while leaving the other NULL, and the insert would work as expected.
MSSQL instead is modal -- there is a connection-wide "SET IDENTITY_INSERT ON/OFF" setting that controls whether or not insert statements will generate new identity values or not. This means that the above scenario can never work, and either all values must be specified, or none. This is kind of out of step with the SA paradigm, so when I first wrote the MSSQL module, I just side-stepped the whole issue by simply disallowing multiple identity columns in a single table. I thought that multiple identity columns in a single table would be a pretty rare occurrence. Maybe I was wrong on that count. At any rate, the prohibition of multiple identity columns is a most probably somewhat artificial constraint that was added to prevent the above scenario, not an intrinsic limitation of SA or the MSSQL module.
Rick
On 9/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
Kent Johnson wrote:
> Michael Bayer wrote:
>> SQLAlchemy should be working with a DBAPI that has auto-commit turned
>> off; this is because the Connection object supports its own "auto
>> commit" feature.
>
> OK, I'll look into reworking mssql to assume that adodbapi connects to a
> DB with autocommit off.
I have a version of mssql that works OK with an unmodified adodbapi - at
least it commits changes!
The reflection stuff is still problematic - even with the cursor change
there are problems detecting identity fields and some of the reflect
unit tests fail with errors like
Multiple identity columns specified for table 'engine_multi'. Only one
identity column per table is allowed.
pymssql has the same problems with the reflection test...
I'm not sure what to do with the changes?? I can put a diff somewhere
but it will have the changes for datatypes also. Should I just make a
new Trac ticket and upload the patch there?
Kent
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users