MCPcopy Create free account
hub / github.com/CloverHealth/temporal-sqlalchemy / defaults_safety

Function defaults_safety

temporal_sqlalchemy/clock.py:144–161  ·  view source on GitHub ↗

ensure client code doesn't use sqlalchemy features that break temporal: column.onupdate column.server_default column.server_onupdate

(*track, mapper)

Source from the content-addressed store, hash-verified

142
143
144def defaults_safety(*track, mapper):
145 """
146 ensure client code doesn't use sqlalchemy features that break temporal:
147 column.onupdate
148 column.server_default
149 column.server_onupdate
150 """
151 warnings.warn("these caveats are temporary", PendingDeprecationWarning)
152 local_props = {mapper.get_property(prop) for prop in track}
153 for prop in local_props:
154 if isinstance(prop, orm.RelationshipProperty):
155 continue
156 assert all(col.onupdate is None for col in prop.columns), \
157 '%r has onupdate' % prop
158 assert all(col.server_default is None for col in prop.columns), \
159 '%r has server_default' % prop
160 assert all(col.server_onupdate is None for col in prop.columns), \
161 '%r has server_onupdate' % prop
162
163
164# TODO kwargs to override default clock table and history tables prefix

Callers 1

make_temporalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected