Hi, I'm a SQLA and MySQL noob.
I have a many to one relationship somewhat similar to this:

class Parent(Base):
    ...
    name = Column(String, primary_key=True)

class Child(Base):
    ...
    parent = Column(String, ForeignKey('Parent.name'))

And I'm trying to do this:

session.add(Child(..., name='NewParent',...))

But on commit, it raises an IntegrityError.

How can I make SQLA automatically insert a Parent in this case?

-- 
Fayaz Yusuf Khan
Cloud developer and designer
Dexetra SS, Kochi, India
fayaz.yusuf.khan_AT_gmail_DOT_com
fayaz_AT_dexetra_DOT_com
+91-9746-830-823

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to