📝 Add source examples for Python 3.9 and 3.10 (#715)

* 📝 Add source examples for Python 3.9 and 3.10

*  Add tests for new source examples for Python 3.9 and 3.10, still needs pytest markers

*  Add tests for fastapi examples

*  Update tests for FastAPI app testing, for Python 3.9 and 3.10, fixing multi-app testing conflicts

*  Require Python 3.9 and 3.10 for tests

*  Update tests with missing markers
This commit is contained in:
Sebastián Ramírez
2023-11-29 16:51:55 +01:00
committed by GitHub
parent cce30d7546
commit d8effcbc5c
243 changed files with 20057 additions and 80 deletions

View File

@ -0,0 +1,34 @@
from sqlmodel import Field, SQLModel, create_engine
class Team(SQLModel, table=True):
id: int | None = Field(default=None, primary_key=True)
name: str = Field(index=True)
headquarters: str
class Hero(SQLModel, table=True):
id: int | None = Field(default=None, primary_key=True)
name: str = Field(index=True)
secret_name: str
age: int | None = Field(default=None, index=True)
team_id: int | None = Field(default=None, foreign_key="team.id")
sqlite_file_name = "database.db"
sqlite_url = f"sqlite:///{sqlite_file_name}"
engine = create_engine(sqlite_url, echo=True)
def create_db_and_tables():
SQLModel.metadata.create_all(engine)
def main():
create_db_and_tables()
if __name__ == "__main__":
main()