I defined several tables in my module file: mymodule.py. For example I have 
table T1 and T2 defined:
class T1(Base):
    __tablename__ = 't1'
    id = Column(Integer, primary_key = True)
    name = Column(String(15))
class T2(Base):
    __tablename__ = 't2'
    id = Column(Integer, primary_key = True)
    fid = Column(Integer, ForeignKey('t1.id', onupdate='CASCADE', 
ondelete='CASCADE'), nullable = False)
    name = Column(String(15))

After running 'alembic revision --autogenerate', in table 't2' migration code, 
I can just see something like that: 
sa.ForeignKeyConstraint(['fid'], ['t1.id'],) without clause 
"onupdate='CASCADE', ondelete='CASCADE'" anymore. 
So I manually added "onupdate='CASCADE', ondelete='CASCADE'", but I have more 
than 100 tables. Did I miss something in my module file mymodule.py?

Thank you very much!

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/-STd7sjYnlYJ.
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