id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 24113,django.db.backends.sqlite3.introspection.get_constraints does not return constraint names.,Damien Nozay,nobody,"`django.db.backends.sqlite3.introspection.get_constraints` does not return constraint names. I was trying to add a regression test for https://github.com/django/django/pull/3862 . However the introspection does not get the constraint names properly. Here is how you would get the equivalent of `show create table` in `sqlite3`. {{{#!python cursor.execute(""SELECT sql FROM sqlite_master WHERE tbl_name = %s"", [table]) result = cursor.fetchall()[0] }}} e.g. this is the output for `tests.schema.models.UniqueTest` {{{ [(u'CREATE TABLE ""schema_uniquetest"" (""id"" integer NOT NULL PRIMARY KEY AUTOINCREMENT, ""year"" integer NOT NULL, ""slug"" varchar(50) NOT NULL, CONSTRAINT ""schema_uniquetest_year_4b36f60cc3fa9c74_uniq"" UNIQUE (""year"", ""slug""))',), }}} vs. the output of `connection.introspection.get_constraints` {{{ {'__primary__': {'check': False, 'columns': [u'id'], 'foreign_key': False, 'index': False, 'primary_key': True, 'unique': False}, u'schema_uniquetest_2dbcba41': {'check': False, 'columns': [u'slug'], 'foreign_key': False, 'index': True, 'primary_key': False, 'unique': False}, u'sqlite_autoindex_schema_uniquetest_1': {'check': False, 'columns': [u'year', u'slug'], 'foreign_key': False, 'index': True, 'primary_key': False, 'unique': True}} }}} side note: would be helpful to refactor `django.db.backends.schema` so that `create_model` uses a helper function that generates the sql statements; which whould make it possible to inspect the sql more easily in tests.",New feature,closed,"Database layer (models, ORM)",dev,Normal,needsinfo,,,Accepted,0,0,0,0,0,0