Thank you Michael. you are definitely the best and most responsive author out there!
On Sunday, May 11, 2014 3:05:32 AM UTC-4, Alexander Luksidadi wrote: > > Im just trying to empties a one to many records by doing this: > > load.commodities = [] > > then what happens next is: > > IntegrityError: (IntegrityError) null value in column "load_id" violates > not-null constraint > DETAIL: Failing row contains (35d39bd9-ca61-43ef-a5c5-7590c82aca1d, > 2014-05-11 06:48:27.028485-04, 2014-05-11 06:51:41.511231-04, Product 4, , 4, > 4, 4, 4, , a637cc84-fd6e-417c-bb59-5a4e3a435696, > a8fca522-3b5f-429f-b58b-c0de4c05d725, null, , inch, lbs). > 'UPDATE load_commodities SET updated_at=%(updated_at)s, load_id=%(load_id)s > WHERE load_commodities.id = %(load_commodities_id)s' {'load_commodities_id': > '35d39bd9-ca61-43ef-a5c5-7590c82aca1d', 'load_id': None, 'updated_at': > datetime.datetime(2014, 5, 11, 6, 51, 41, 511231)} > > > it seems like it triggers update and set all the fields to None instead of > delete. > > > here're my classes: > > class Load(Base): > __tablename__ = 'loads' > id = Column(GUID, primary_key=True, default=uuid.uuid4) > .... > commodities = relationship("LoadCommodity", backref=backref("load", > uselist=False)) > > class LoadCommodity(Base): > __tablename__ = 'load_commodities' > id = Column(GUID, primary_key=True, default=uuid.uuid4) > load_id = Column(GUID, ForeignKey('loads.id'), nullable=False) > .... > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.