On Aug 19, 2011, at 2:10 PM, Mike Conley wrote:
> class Parent(Base):
> __tablename__ = 'parent'
> id = Column(Integer, primary_key=True)
> class Child(Base):
> __tablename__ = 'child'
> id = Column(Integer, primary_key=True)
> p_id = Column(Integer, ForeignKey(Parent.id))
>
The default relationship cascade settings will do it for you. Here I made
them explicit.
class Parent(Base):
__tablename__ = 'parent'
id = Column(Integer, primary_key=True)
class Child(Base):
__tablename__ = 'child'
id = Column(Integer, primary_key=True)
p_id = Column(Integer,
I have a table that has a foreign key field that is optional. IOW, the current
row may be linked to at most one row in the foreign table. If the foreign key
field is not NULL, it must point to a valid row in the foreign table, but if it
is NULL that means that it it not linked.
Is there an aut