MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / _index_query

Method _index_query

lib/sqlalchemy/dialects/oracle/base.py:3118–3168  ·  view source on GitHub ↗
(self, owner)

Source from the content-addressed store, hash-verified

3116
3117 @lru_cache()
3118 def _index_query(self, owner):
3119 return (
3120 select(
3121 dictionary.all_ind_columns.c.table_name,
3122 dictionary.all_ind_columns.c.index_name,
3123 dictionary.all_ind_columns.c.column_name,
3124 dictionary.all_indexes.c.index_type,
3125 dictionary.all_indexes.c.uniqueness,
3126 dictionary.all_indexes.c.compression,
3127 dictionary.all_indexes.c.prefix_length,
3128 dictionary.all_ind_columns.c.descend,
3129 dictionary.all_ind_expressions.c.column_expression,
3130 )
3131 .select_from(dictionary.all_ind_columns)
3132 .join(
3133 dictionary.all_indexes,
3134 sql.and_(
3135 dictionary.all_ind_columns.c.index_name
3136 == dictionary.all_indexes.c.index_name,
3137 dictionary.all_ind_columns.c.index_owner
3138 == dictionary.all_indexes.c.owner,
3139 ),
3140 )
3141 .outerjoin(
3142 # NOTE: this adds about 20% to the query time. Using a
3143 # case expression with a scalar subquery only when needed
3144 # with the assumption that most indexes are not expression
3145 # would be faster but oracle does not like that with
3146 # LONG datatype. It errors with:
3147 # ORA-00997: illegal use of LONG datatype
3148 dictionary.all_ind_expressions,
3149 sql.and_(
3150 dictionary.all_ind_expressions.c.index_name
3151 == dictionary.all_ind_columns.c.index_name,
3152 dictionary.all_ind_expressions.c.index_owner
3153 == dictionary.all_ind_columns.c.index_owner,
3154 dictionary.all_ind_expressions.c.column_position
3155 == dictionary.all_ind_columns.c.column_position,
3156 ),
3157 )
3158 .where(
3159 dictionary.all_indexes.c.table_owner == owner,
3160 dictionary.all_indexes.c.table_name.in_(
3161 bindparam("all_objects")
3162 ),
3163 )
3164 .order_by(
3165 dictionary.all_ind_columns.c.index_name,
3166 dictionary.all_ind_columns.c.column_position,
3167 )
3168 )
3169
3170 @reflection.flexi_cache(
3171 ("schema", InternalTraversal.dp_string),

Callers 1

_get_indexes_rowsMethod · 0.95

Calls 9

selectFunction · 0.90
bindparamFunction · 0.85
order_byMethod · 0.45
whereMethod · 0.45
outerjoinMethod · 0.45
joinMethod · 0.45
select_fromMethod · 0.45
and_Method · 0.45
in_Method · 0.45

Tested by

no test coverage detected