Hi,

I'm not sure if this is really a bug but at least it's not intuitive... :)
I'm trying to determine if the primary key for a table will be
autogenerated by the database or not by peeking into
Column.autoincrement, however, the following unit test fails:

import unittest
from sqlalchemy import Table, Column, types, MetaData

meta = MetaData()

table_autoincr = Table("some_table", meta,
    Column('id', types.Integer, primary_key=True),
    Column('somefield', types.String),
    )

table_no_autoincr = Table("country", meta,
    Column('code', types.String(2), primary_key=True),
    Column('name', types.String),
    )

class TestAutoincrementFlag(unittest.TestCase):
    def test_table_with_serial_pk(self):
        self.failUnless(table_autoincr.c.id.autoincrement)

    def test_table_with_non_serial_pk(self):
        # This one fails
        self.failUnless(not table_no_autoincr.c.code.autoincrement)

if __name__ == '__main__':
    unittest.main()

Are my assumptions wrong or is this really a bug? If the former, what
would be the correct way to determine if I can safely omit a column
value on an insert?

Thanks
Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to