sqlalchemy and auto increments with postgresql

后端 未结 3 890
臣服心动
臣服心动 2021-01-13 15:37

I created a table with a primary key and a sequence but via the debug ad later looking at the table design, the sequence isn\'t applied, just created.

from s         


        
3条回答
  •  孤独总比滥情好
    2021-01-13 16:06

    I ran into a similar issue with composite multi-column primary keys. The SERIAL is only implicitly applied to a single column primary key. However, this behaviour can be controlled via the autoincrement argument (defaults to "auto"):

    id = Column(Integer, primary_key=True, autoincrement=True)
    

提交回复
热议问题