Constraint name for AUTOINCREMENT of sqlite failing
this fails:
from querybuilder.schemas.helper import table, ColumnSpec
from querybuilder.drivers.sqlite.connector.Connector
@table
class tbl:
x: ColumnSpec(int, generated_as_identity="named_constraint")
conn = Connector("")
conn.execute(tbl.create())
It seems that
CREATE TABLE tbl (x INTEGER PRIMARY KEY CONSTRAINT named_constraint AUTOINCREMENT)
is not a valid sqlite query.
We should :
- consider whether
CONSTRAINT named_constraint GENERATED ALWAYS AS IDENTITY
in standard SQL is valid; - if 1. has a positive answer, then overload (again) the sqlite tokenizer so that it drops the constraint name with a warning (or raise an appropriate exception). Otherwise, if 1. has a negative answer, then we should disallow naming
generated_as_identity
constraints.
Edited by Bruno Guillon