MCPcopy
hub / github.com/django/django / get_indexes

Method get_indexes

tests/schema/tests.py:200–211  ·  view source on GitHub ↗

Get the indexes on the table using a new cursor.

(self, table)

Source from the content-addressed store, hash-verified

198 return connection.introspection.get_primary_key_column(cursor, table)
199
200 def get_indexes(self, table):
201 """
202 Get the indexes on the table using a new cursor.
203 """
204 with connection.cursor() as cursor:
205 return [
206 c["columns"][0]
207 for c in connection.introspection.get_constraints(
208 cursor, table
209 ).values()
210 if c["index"] and len(c["columns"]) == 1
211 ]
212
213 def get_uniques(self, table):
214 with connection.cursor() as cursor:

Calls 3

cursorMethod · 0.80
valuesMethod · 0.45
get_constraintsMethod · 0.45

Tested by

no test coverage detected