MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / Child

Class Child

examples/versioned_rows/versioned_rows_w_versionid.py:132–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130
131
132class Child(Versioned, Base):
133 __tablename__ = "child"
134
135 data = Column(String)
136
137 def new_version(self, session):
138 # expire parent's reference to us
139 session.expire(self.parent, ["child"])
140
141 # create new version
142 Versioned.new_version(self, session)
143
144 # re-add ourselves to the parent. this causes the
145 # parent foreign key to be updated also
146 self.parent.child = self
147
148
149Base.metadata.create_all(engine)

Callers 1

Calls 1

ColumnClass · 0.90

Tested by

no test coverage detected