(
self,
update_stmt: Update,
visiting_cte: Optional[CTE] = None,
**kw: Any,
)
| 6329 | ) |
| 6330 | |
| 6331 | def visit_update( |
| 6332 | self, |
| 6333 | update_stmt: Update, |
| 6334 | visiting_cte: Optional[CTE] = None, |
| 6335 | **kw: Any, |
| 6336 | ) -> str: |
| 6337 | compile_state = update_stmt._compile_state_factory( |
| 6338 | update_stmt, self, **kw |
| 6339 | ) |
| 6340 | if TYPE_CHECKING: |
| 6341 | assert isinstance(compile_state, UpdateDMLState) |
| 6342 | update_stmt = compile_state.statement # type: ignore[assignment] |
| 6343 | |
| 6344 | if visiting_cte is not None: |
| 6345 | kw["visiting_cte"] = visiting_cte |
| 6346 | toplevel = False |
| 6347 | else: |
| 6348 | toplevel = not self.stack |
| 6349 | |
| 6350 | if toplevel: |
| 6351 | self.isupdate = True |
| 6352 | if not self.dml_compile_state: |
| 6353 | self.dml_compile_state = compile_state |
| 6354 | if not self.compile_state: |
| 6355 | self.compile_state = compile_state |
| 6356 | |
| 6357 | if self.linting & COLLECT_CARTESIAN_PRODUCTS: |
| 6358 | from_linter = FromLinter({}, set()) |
| 6359 | warn_linting = self.linting & WARN_LINTING |
| 6360 | if toplevel: |
| 6361 | self.from_linter = from_linter |
| 6362 | else: |
| 6363 | from_linter = None |
| 6364 | warn_linting = False |
| 6365 | |
| 6366 | extra_froms = compile_state._extra_froms |
| 6367 | is_multitable = bool(extra_froms) |
| 6368 | |
| 6369 | if is_multitable: |
| 6370 | # main table might be a JOIN |
| 6371 | main_froms = set(_from_objects(update_stmt.table)) |
| 6372 | render_extra_froms = [ |
| 6373 | f for f in extra_froms if f not in main_froms |
| 6374 | ] |
| 6375 | correlate_froms = main_froms.union(extra_froms) |
| 6376 | else: |
| 6377 | render_extra_froms = [] |
| 6378 | correlate_froms = {update_stmt.table} |
| 6379 | |
| 6380 | self.stack.append( |
| 6381 | { |
| 6382 | "correlate_froms": correlate_froms, |
| 6383 | "asfrom_froms": correlate_froms, |
| 6384 | "selectable": update_stmt, |
| 6385 | } |
| 6386 | ) |
| 6387 | |
| 6388 | text = "UPDATE " |
nothing calls this directly
no test coverage detected