First Check
Commit to Help
Example Code
fromtypingimportOptionalfromsqlmodelimportSQLModel, Field, create_engineclassTest(SQLModel, table=True):
id: Optional[int] =Field(default=None, primary_key=True)
a: strb: Optional[str] =Nonec: str=Field(default="Hey")
d: str="hey"sqlite_url=""# define a path hereengine=create_engine(sqlite_url, echo=True)
SQLModel.metadata.create_all(engine)
Description
The above code example issues the following create table sql command:
CREATETABLEtest (
id INTEGER, a VARCHARNOT NULL, b VARCHAR, c VARCHAR, d VARCHAR, PRIMARY KEY (id)
)
whereas I would expect columns c and d to be marked as NOT NULL as well.
I think the documentation also points to my point of view as stated here.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.5
Additional Context
No response
First Check
Commit to Help
Example Code
Description
The above code example issues the following create table sql command:
whereas I would expect columns
canddto be marked asNOT NULLas well.I think the documentation also points to my point of view as stated here.
Operating System
Linux
Operating System Details
No response
SQLModel Version
0.0.4
Python Version
3.8.5
Additional Context
No response