This commit is contained in:
2025-05-22 20:25:38 +02:00
parent 09f6750c2b
commit ce03fbf12f
529 changed files with 3353 additions and 3312 deletions

View File

@@ -491,10 +491,10 @@ def _key_getters_for_crud_column(
key: Union[ColumnClause[Any], str]
) -> Union[str, Tuple[str, str]]:
str_key = c_key_role(key)
if hasattr(key, "table") and key.table in _et: # type: ignore
if hasattr(key, "table") and key.table in _et:
return (key.table.name, str_key) # type: ignore
else:
return str_key # type: ignore
return str_key
def _getattr_col_key(
col: ColumnClause[Any],
@@ -513,7 +513,7 @@ def _key_getters_for_crud_column(
return col.key
else:
_column_as_key = functools.partial( # type: ignore
_column_as_key = functools.partial(
coercions.expect_as_key, roles.DMLColumnRole
)
_getattr_col_key = _col_bind_name = operator.attrgetter("key") # type: ignore # noqa: E501
@@ -647,6 +647,9 @@ def _scan_cols(
compiler_implicit_returning = compiler.implicit_returning
# TODO - see TODO(return_defaults_columns) below
# cols_in_params = set()
for c in cols:
# scan through every column in the target table
@@ -672,6 +675,9 @@ def _scan_cols(
kw,
)
# TODO - see TODO(return_defaults_columns) below
# cols_in_params.add(c)
elif isinsert:
# no parameter is present and it's an insert.
@@ -764,6 +770,19 @@ def _scan_cols(
if c in remaining_supplemental
)
# TODO(return_defaults_columns): there can still be more columns in
# _return_defaults_columns in the case that they are from something like an
# aliased of the table. we can add them here, however this breaks other ORM
# things. so this is for another day. see
# test/orm/dml/test_update_delete_where.py -> test_update_from_alias
# if stmt._return_defaults_columns:
# compiler_implicit_returning.extend(
# set(stmt._return_defaults_columns)
# .difference(compiler_implicit_returning)
# .difference(cols_in_params)
# )
return (use_insertmanyvalues, use_sentinel_columns)
@@ -1559,7 +1578,11 @@ def _get_returning_modifiers(compiler, stmt, compile_state, toplevel):
should_implicit_return_defaults = (
implicit_returning and stmt._return_defaults
)
explicit_returning = should_implicit_return_defaults or stmt._returning
explicit_returning = (
should_implicit_return_defaults
or stmt._returning
or stmt._supplemental_returning
)
use_insertmanyvalues = (
toplevel
and compiler.for_executemany