Hi,

I have been trying to create an autoincrement field for a postgres
table and it just doesn't seem to work unless the column is also the
primary key.  (An initial look at the postgres.py file in databases
seems to confirm this but I am a complete newb when it comes to the SA
source).

I have tried

    creation_order = Column('creation_order', PGBigInteger,
autoincrement=True)
    creation_order = Column('creation_order', PGBigInteger,
primary_key=False, autoincrement=True)
    creation_order = Column('creation_order', PGBigInteger, Sequence
('creation_order_seq'))

Then I figured that as long as a sequence gets created during
create_all I can just set a default value like this;

    __table_args__ = (Sequence("creation_order_seq"))
    creation_order = Column('creation_order', PGBigInteger,
                            default=func.nextval
('creation_order_seq'))

This half works, the sequence doesn't get created but after I do
create it by hand the behaviour is as I want.

What am I doing wrong?

Regards, Simon.

--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to