MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _post_update

Function _post_update

lib/sqlalchemy/orm/persistence.py:122–164  ·  view source on GitHub ↗

Issue UPDATE statements on behalf of a relationship() which specifies post_update.

(base_mapper, states, uowtransaction, post_update_cols)

Source from the content-addressed store, hash-verified

120
121
122def _post_update(base_mapper, states, uowtransaction, post_update_cols):
123 """Issue UPDATE statements on behalf of a relationship() which
124 specifies post_update.
125
126 """
127
128 states_to_update = list(
129 _organize_states_for_post_update(base_mapper, states, uowtransaction)
130 )
131
132 for table, mapper in base_mapper._sorted_tables.items():
133 if table not in mapper._pks_by_table:
134 continue
135
136 update = (
137 (
138 state,
139 state_dict,
140 sub_mapper,
141 connection,
142 (
143 mapper._get_committed_state_attr_by_column(
144 state, state_dict, mapper.version_id_col
145 )
146 if mapper.version_id_col is not None
147 else None
148 ),
149 )
150 for state, state_dict, sub_mapper, connection in states_to_update
151 if table in sub_mapper._pks_by_table
152 )
153
154 update = _collect_post_update_commands(
155 base_mapper, uowtransaction, table, update, post_update_cols
156 )
157
158 _emit_post_update_statements(
159 base_mapper,
160 uowtransaction,
161 mapper,
162 table,
163 update,
164 )
165
166
167def _delete_obj(base_mapper, states, uowtransaction):

Callers

nothing calls this directly

Tested by

no test coverage detected