ensure client code doesn't use sqlalchemy features that break temporal: column.onupdate column.server_default column.server_onupdate
(*track, mapper)
| 142 | |
| 143 | |
| 144 | def 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 |