MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / _fetch_multi_columns

Method _fetch_multi_columns

lib/sqlalchemy/dialects/mssql/base.py:4004–4045  ·  view source on GitHub ↗

Execute the unified columns select for a single catalog pass. Used by :meth:`.get_multi_columns` for both the main-database pass (no ``schema_translate_map``) and the tempdb pass (with ``schema_translate_map={"sys": "tempdb.sys"}`` applied).

(
        self, connection, owner, names, schema, name_map, result, exec_opts
    )

Source from the content-addressed store, hash-verified

4002 return result.items()
4003
4004 def _fetch_multi_columns(
4005 self, connection, owner, names, schema, name_map, result, exec_opts
4006 ):
4007 """Execute the unified columns select for a single catalog pass.
4008
4009 Used by :meth:`.get_multi_columns` for both the main-database pass
4010 (no ``schema_translate_map``) and the tempdb pass (with
4011 ``schema_translate_map={"sys": "tempdb.sys"}`` applied).
4012 """
4013 s = self._columns_select()
4014
4015 rp = connection.execute(
4016 s,
4017 {"owner": owner, "filter_names": names},
4018 execution_options=exec_opts,
4019 )
4020
4021 for row in rp.mappings():
4022 table_name = name_map(row["table_name"])
4023 cdict = self._parse_column_info(
4024 name=row["column_name"],
4025 type_=row["type_name"],
4026 base_type=row["base_type"],
4027 nullable=row["is_nullable"] == 1,
4028 maxlen=row["max_length"],
4029 numericprec=row["precision"],
4030 numericscale=row["scale"],
4031 default=row["default_value"],
4032 collation=row["collation_name"],
4033 definition=row["computed_definition"],
4034 is_persisted=row["is_persisted"],
4035 is_identity=row["is_identity"],
4036 identity_start=row["seed_value"],
4037 identity_increment=row["increment_value"],
4038 comment=row["comment"],
4039 )
4040 result.setdefault((schema, table_name), []).append(cdict)
4041
4042 for n in names:
4043 key = (schema, name_map(n))
4044 if key not in result:
4045 result[key] = ReflectionDefaults.columns()
4046
4047 def _fetch_multi_columns_temp(
4048 self, connection, temp_names, schema, result

Callers 2

get_multi_columnsMethod · 0.95

Calls 7

_columns_selectMethod · 0.95
_parse_column_infoMethod · 0.95
executeMethod · 0.45
mappingsMethod · 0.45
appendMethod · 0.45
setdefaultMethod · 0.45
columnsMethod · 0.45

Tested by

no test coverage detected