summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3/introspection.py
AgeCommit message (Collapse)Author
2026-01-18Applied Black's 2026 stable style.Mariusz Felisiak
https://github.com/psf/black/releases/tag/26.1.0
2025-10-31Fixed #36661 -- Added introspection of database-level delete options.Mariusz Felisiak
2025-10-18Fixed #36671 -- Dropped support for SQLite < 3.37.Mariusz Felisiak
2025-04-30Fixed #36358 -- Corrected introspection of composite primary keys on SQLite.Simon Charette
Previously, any first field of a composite primary key with type `INTEGER` was incorrectly introspected as an `AutoField` due to SQLite treating `INTEGER PRIMARY KEY` as an alias for the `ROWID`. This change ensures that integer fields in composite PKs are not mistaken for auto-incrementing fields. Thanks Jacob Walls and Sarah Boyce for the reviews.
2025-03-31Refs #28909 -- Simplified code using unpacking generalizations.Aarni Koskela
2024-09-17Fixed #35762 -- Avoided unneeded quote_name() calls in SQLite introspection.Claude Paroz
Double-quoting string literals is deprecated in recent SQLite versions. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2023-09-07Fixed #31300 -- Added GeneratedField model field.Jeremy Nauta
Thanks Adam Johnson and Paolo Melchiorre for reviews. Co-Authored-By: Lily Foote <code@lilyf.org> Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-08Made inspectdb used Cursor.description.display_size for CharFields' max_length.Mariusz Felisiak
internal_size is size for fixed-size types not for char types.
2022-06-01Fixed #32234 -- Made inspectdb inform about composite primary keys.Anv3sh
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2021-11-15Refs #33288 -- Removed SQLite's ↵Simon Charette
DatabaseIntrospection._get_foreign_key_constraints(). The get_relations() method returns the exact same data in a more generic format.
2021-11-15Fixed #33288 -- Made SQLite introspection use information schema for relations.Simon Charette
Previous solution was using brittle and complex parsing rules to extract them from the SQL used to define the tables. Removed a now unnecessary unit test that ensured the removed parsing logic accounted for optional spacing.
2021-11-15Refs #33288 -- Made SQLite introspection raise DatabaseError on nonexistent ↵Simon Charette
tables. All the other backends behave this way and we had to make adjustments to our test suite to account for this discrepancy. This also allows SQLite's get_relations() not to raise on a nonexistent table while making sure the InspectDBTestCase.test_introspection_errors test which ensures an error during introspection is surfaced in generated models files still passes.
2021-11-10Removed DatabaseIntrospection.get_key_columns().Mariusz Felisiak
Thanks Simon Charette for the report.
2021-11-10Fixed DatabaseIntrospection.get_relations() docstring.Tim Graham
The foreign keys are "in" the given table, not "to" it.
2021-10-26Fixed #32672 -- Fixed introspection of primary key constraints on SQLite.Anv3sh
Thanks Simon Charette for the implementation idea.
2021-02-17Fixed #32453 -- Added introspection of unique constraint field ordering on ↵Hannes Ljungberg
SQLite. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-01-13Fixed #26167 -- Added support for functional indexes.Hannes Ljungberg
Thanks Simon Charette, Mads Jensen, and Mariusz Felisiak for reviews. Co-authored-by: Markus Holtermann <info@markusholtermann.eu>
2020-09-21Fixed #31777 -- Added support for database collations to Char/TextFields.Tom Carrick
Thanks Simon Charette and Mariusz Felisiak for reviews.
2020-05-11Refs #30116 -- Simplified regex match group access with Match.__getitem__().Jon Dufresne
The method has been available since Python 3.6. The shorter syntax is also marginally faster.
2020-05-08Fixed #12990, Refs #27694 -- Added JSONField model field.sage
Thanks to Adam Johnson, Carlton Gibson, Mariusz Felisiak, and Raphael Michel for mentoring this Google Summer of Code 2019 project and everyone else who helped with the patch. Special thanks to Mads Jensen, Nick Pope, and Simon Charette for extensive reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-02-04Simplified imports from django.db and django.contrib.gis.db.Nick Pope
2019-11-19Fixed #30987 -- Added models.PositiveBigIntegerField.Caio Ariede
2019-10-29Fixed #30899 -- Lazily compiled import time regular expressions.Hasan Ramezani
2019-08-02Fixed #30661 -- Added models.SmallAutoField.Nick Pope
2019-03-13Fixed #30183 -- Added introspection of inline SQLite constraints.Paveł Tyślacki
2019-03-01Refs #30183 -- Moved SQLite table constraint parsing to a method.Paveł Tyślacki
2019-03-01Unified nonexistent foreign key introspection value for SQLite.Paveł Tyślacki
2019-01-22Fixed #30115 -- Fixed SQLite introspection crash with a varchar primary key.Nick Pope
Removed obsolete max_length handling for CharField that caused the issue. Regression in a35d2a4510d5beec398b1007aaa26492d6aedf97.
2019-01-22Inlined DatabaseIntrospection._table_info() for SQLite.Nick Pope
2019-01-09Refs #23748 -- Added AutoField introspection for SQLite.Nick Pope
2018-12-22Renamed Sqlite and Sqlite3 references to SQLite.Nick Pope
2018-11-13Fixed #29641 -- Added support for unique constraints in Meta.constraints.Simon Charette
This constraint is similar to Meta.unique_together but also allows specifying a name. Co-authored-by: Ian Foote <python@ian.feete.org>
2018-11-13Refs #29641 -- Refactored database schema constraint creation.Simon Charette
Added a test for constraint names in the database. Updated SQLite introspection to use sqlparse to allow reading the constraint name for table check and unique constraints. Co-authored-by: Ian Foote <python@ian.feete.org>
2018-06-25Fixed #29517 -- Added support for SQLite column check constraints on ↵Tim Graham
positive integer fields.
2018-05-08Refs #29350 -- Fixed 'invalid escape sequence' warning in SQLite introspection.Tim Graham
2018-04-28Fixed #29350 -- Fix get_primary_key_column() method in sqlite3 backendZackary Troop
Thanks Tim Graham and Mariusz Felisiak for the reviews.
2018-01-27Fixed #29004 -- Added inspectdb --include-views option.bquinn
2017-12-22Fixed #28884 -- Fixed crash on SQLite when renaming a field in a model ↵Simon Charette
referenced by a ManyToManyField. Introspected database constraints instead of relying on _meta.related_objects to determine whether or not a table or a column is referenced on rename operations. This has the side effect of ignoring both db_constraint=False and virtual fields such as GenericRelation which aren't backend by database level constraints and thus shouldn't prevent the rename operations from being performed in a transaction. Regression in 095c1aaa898bed40568009db836aa8434f1b983d. Thanks Tim for the additional tests and edits, and Mariusz for the review.
2017-10-03Fixed #28584 -- Dropped support for SQLite < 3.7.15.Tim Graham
2017-09-22Refs #27098 -- Removed DatabaseIntrospection.get_indexes() per deprecation ↵Tim Graham
timeline.
2017-09-13Refs #27090 -- Added real database sequence introspection.Mariusz Felisiak
Thanks Mariusz Felisiak for the Oracle part and Tim Graham for the review.
2017-07-11Fixed #14204 -- Enforced SQLite foreign key constraints.Claude Paroz
Thanks Tim Graham for contributing to the patch and Simon Charette for advice and review.
2017-02-28Refs #27656 -- Updated django.db docstring verbs according to PEP 257.Anton Samarchyan
2017-02-15Fixed #27135 -- Made index introspection return Index.suffix.Tim Graham
2017-01-19Refs #23919 -- Stopped inheriting from object to define new style classes.Simon Charette
2016-11-30Refs #24245 -- Added introspection for database defaults on Oracle.Mariusz Felisiak
2016-11-06Fixed #27372 -- Fixed introspection of SQLite foreign keys with spaces in DDL.Saulius Žemaitaitis
Thanks samuller for the report and initial patch.
2016-09-17Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.Tim Graham
http://bugs.python.org/issue27364