Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d05c3ee
commit ab08cbd
Showing
13 changed files
with
107 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
from typing import Optional # (1) | ||
from typing import Optional # (1)! | ||
|
||
from sqlmodel import Field, SQLModel, create_engine # (2) | ||
from sqlmodel import Field, SQLModel, create_engine # (2)! | ||
|
||
|
||
class Hero(SQLModel, table=True): # (3) | ||
id: Optional[int] = Field(default=None, primary_key=True) # (4) | ||
name: str # (5) | ||
secret_name: str # (6) | ||
age: Optional[int] = None # (7) | ||
class Hero(SQLModel, table=True): # (3)! | ||
id: Optional[int] = Field(default=None, primary_key=True) # (4)! | ||
name: str # (5)! | ||
secret_name: str # (6)! | ||
age: Optional[int] = None # (7)! | ||
|
||
|
||
sqlite_file_name = "database.db" # (8) | ||
sqlite_url = f"sqlite:///{sqlite_file_name}" # (9) | ||
sqlite_file_name = "database.db" # (8)! | ||
sqlite_url = f"sqlite:///{sqlite_file_name}" # (9)! | ||
|
||
engine = create_engine(sqlite_url, echo=True) # (10) | ||
engine = create_engine(sqlite_url, echo=True) # (10)! | ||
|
||
|
||
def create_db_and_tables(): # (11) | ||
SQLModel.metadata.create_all(engine) # (12) | ||
def create_db_and_tables(): # (11)! | ||
SQLModel.metadata.create_all(engine) # (12)! | ||
|
||
|
||
if __name__ == "__main__": # (13) | ||
create_db_and_tables() # (14) | ||
if __name__ == "__main__": # (13)! | ||
create_db_and_tables() # (14)! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_004.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
docs_src/tutorial/fastapi/app_testing/tutorial001/test_main_005.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.