class CursorResultMetaData(ResultMetaData):
Known subclasses: sqlalchemy.engine.cursor.LegacyCursorResultMetaData
Class Method | _create_description_match_map |
when matching cursor.description to a set of names that are present in a Compiled object, as is the case with TextualSelect, get all the names we expect might match those in cursor.description. |
Method | __getstate__ |
Undocumented |
Method | __init__ |
Undocumented |
Method | __setstate__ |
Undocumented |
Method | _adapt_to_context |
No summary |
Method | _colnames_from_description |
Extract column names and data types from a cursor.description. |
Method | _for_freeze |
Undocumented |
Method | _has_key |
Undocumented |
Method | _index_for_key |
Undocumented |
Method | _indexes_for_keys |
Undocumented |
Method | _key_fallback |
Undocumented |
Method | _merge_cols_by_name |
Undocumented |
Method | _merge_cols_by_none |
Undocumented |
Method | _merge_cursor_description |
Merge a cursor.description with compiled result column information. |
Method | _merge_textual_cols_by_position |
Undocumented |
Method | _metadata_for_keys |
Undocumented |
Method | _raise_for_ambiguous_column_name |
Undocumented |
Method | _reduce |
Undocumented |
Class Variable | __slots__ |
Undocumented |
Class Variable | returns_rows |
Undocumented |
Instance Variable | _keymap |
Undocumented |
Instance Variable | _keymap_by_result_column_idx |
Undocumented |
Instance Variable | _keys |
Undocumented |
Instance Variable | _processors |
Undocumented |
Instance Variable | _safe_for_cache |
Undocumented |
Instance Variable | _translated_indexes |
Undocumented |
Instance Variable | _tuplefilter |
Undocumented |
Instance Variable | case_sensitive |
Undocumented |
Inherited from ResultMetaData
:
Method | _getter |
Undocumented |
Method | _raise_for_nonint |
Undocumented |
Method | _row_as_tuple_getter |
Undocumented |
Method | _warn_for_nonint |
Undocumented |
Class Variable | _unique_filters |
Undocumented |
Property | keys |
Undocumented |
Extract column names and data types from a cursor.description.
Applies unicode decoding, column translation, "normalization", and case sensitivity rules to the names based on the dialect.
sqlalchemy.engine.cursor.LegacyCursorResultMetaData
Undocumented
sqlalchemy.engine.cursor.LegacyCursorResultMetaData
Undocumented
Undocumented
Merge a cursor.description with compiled result column information.
There are at least four separate strategies used here, selected depending on the type of SQL construct used to start with.
The most common case is that of the compiled SQL expression construct, which generated the column names present in the raw SQL string and which has the identical number of columns as were reported by cursor.description. In this case, we assume a 1-1 positional mapping between the entries in cursor.description and the compiled object. This is also the most performant case as we disregard extracting / decoding the column names present in cursor.description since we already have the desired name we generated in the compiled SQL construct.
The next common case is that of the completely raw string SQL, such as passed to connection.execute(). In this case we have no compiled construct to work with, so we extract and decode the names from cursor.description and index those as the primary result row target keys.
The remaining fairly common case is that of the textual SQL
that includes at least partial column information; this is when
we use a _expression.TextualSelect
construct.
This construct may have
unordered or ordered column information. In the ordered case, we
merge the cursor.description and the compiled construct's information
positionally, and warn if there are additional description names
present, however we still decode the names in cursor.description
as we don't have a guarantee that the names in the columns match
on these. In the unordered case, we match names in cursor.description
to that of the compiled construct based on name matching.
In both of these cases, the cursor.description names and the column
expression objects and names are indexed as result row target keys.
The final case is much less common, where we have a compiled non-textual SQL expression construct, but the number of columns in cursor.description doesn't match what's in the compiled construct. We make the guess here that there might be textual column expressions in the compiled construct that themselves include a comma in them causing them to split. We do the same name-matching as with textual non-ordered columns.
The name-matched system of merging is the same as that used by
SQLAlchemy for all cases up through te 0.9 series. Positional
matching for compiled SQL expressions was introduced in 1.0 as a
major performance feature, and positional matching for textual
_expression.TextualSelect
objects in 1.1.
As name matching is no longer
a common case, it was acceptable to factor it into smaller generator-
oriented methods that are easier to understand, but incur slightly
more performance overhead.
Undocumented
tuple[ str, ...]
=
sqlalchemy.engine.cursor.LegacyCursorResultMetaData
Undocumented