MCPcopy
hub / github.com/django/django / column_classes

Method column_classes

tests/schema/tests.py:181–194  ·  view source on GitHub ↗
(self, model)

Source from the content-addressed store, hash-verified

179 connection.enable_constraint_checking()
180
181 def column_classes(self, model):
182 with connection.cursor() as cursor:
183 columns = {
184 d[0]: (connection.introspection.get_field_type(d[1], d), d)
185 for d in connection.introspection.get_table_description(
186 cursor,
187 model._meta.db_table,
188 )
189 }
190 # SQLite has a different format for field_type
191 for name, (type, desc) in columns.items():
192 if isinstance(type, tuple):
193 columns[name] = (type[0], desc)
194 return columns
195
196 def get_primary_key(self, table):
197 with connection.cursor() as cursor:

Calls 4

cursorMethod · 0.80
get_field_typeMethod · 0.45
get_table_descriptionMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected