MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _append_param_parameter

Function _append_param_parameter

lib/sqlalchemy/sql/crud.py:932–1046  ·  view source on GitHub ↗
(
    compiler,
    stmt,
    compile_state,
    c,
    col_key,
    parameters,
    _col_bind_name,
    implicit_returning,
    implicit_return_defaults,
    postfetch_lastrowid,
    values,
    autoincrement_col,
    insert_null_pk_still_autoincrements,
    kw,
)

Source from the content-addressed store, hash-verified

930
931
932def _append_param_parameter(
933 compiler,
934 stmt,
935 compile_state,
936 c,
937 col_key,
938 parameters,
939 _col_bind_name,
940 implicit_returning,
941 implicit_return_defaults,
942 postfetch_lastrowid,
943 values,
944 autoincrement_col,
945 insert_null_pk_still_autoincrements,
946 kw,
947):
948 value = parameters.pop(col_key)
949
950 has_visiting_cte = kw.get("visiting_cte") is not None
951 col_value = compiler.preparer.format_column(
952 c, use_table=compile_state.include_table_with_column_exprs
953 )
954
955 accumulated_bind_names: Set[str] = set()
956
957 if coercions._is_literal(value):
958 if (
959 insert_null_pk_still_autoincrements
960 and c.primary_key
961 and c is autoincrement_col
962 ):
963 # support use case for #7998, fetch autoincrement cols
964 # even if value was given.
965
966 if postfetch_lastrowid:
967 compiler.postfetch_lastrowid = True
968 elif implicit_returning:
969 compiler.implicit_returning.append(c)
970
971 value = _create_bind_param(
972 compiler,
973 c,
974 value,
975 required=value is REQUIRED,
976 name=(
977 _col_bind_name(c)
978 if not _compile_state_isinsert(compile_state)
979 or not compile_state._has_multi_parameters
980 else "%s_m0" % _col_bind_name(c)
981 ),
982 accumulate_bind_names=accumulated_bind_names,
983 force_anonymous=has_visiting_cte,
984 **kw,
985 )
986 elif value._is_bind_parameter:
987 if (
988 insert_null_pk_still_autoincrements
989 and value.value is None

Callers 1

_scan_colsFunction · 0.85

Calls 9

_create_bind_paramFunction · 0.85
_col_bind_nameFunction · 0.85
format_columnMethod · 0.80
popMethod · 0.45
getMethod · 0.45
appendMethod · 0.45
processMethod · 0.45
self_groupMethod · 0.45

Tested by

no test coverage detected