The current logic is that, if a table has no primary key, it doesn't use the declarative class generator. However, sqlite has the hidden rowid column which acts as a primary key. For this reason, I want to generate a dataclass and then add rowid as the primary key so that I get all the nice type safety of a dataclass. There are probably also other use cases for ignoring this rule.
Thus, this PR adds a new option called force_class that will generate a dataclass even if there is no obvious primary key.
The current logic is that, if a table has no primary key, it doesn't use the declarative class generator. However, sqlite has the hidden
rowid
column which acts as a primary key. For this reason, I want to generate a dataclass and then addrowid
as the primary key so that I get all the nice type safety of a dataclass. There are probably also other use cases for ignoring this rule.Thus, this PR adds a new option called
force_class
that will generate a dataclass even if there is no obvious primary key.