I am using Django models for a SQLite database.
I defined CharField primary key (for example the name of attribute A
) but the physical database synced by Django
shows another primary key rowid
instead of A
.
I tried dropping the table and re-sync a couple of time but still the same.
Why?
class TestTable(models.Model):
A = models.CharField(max_length=10, primary_key=True, db_column='A')
----------------------Edit------------------------
Django version is 1.8.3
SQLITE databases always create a rowid column by default. This is the actual primary key SQLITE uses for manage the database. This is different from what you see in other SQL databases, but SQLITE is pretty different in more things.
For more info look at https://www.sqlite.org/rowidtable.html
P.S. I know that this is 2 years late, but it might help someone if not OP.