From: Yurii Motov Date: Fri, 20 Feb 2026 23:17:35 +0000 (+0100) Subject: Remove code examples for Python 3.9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e975d7746c391ff093e02e022845226f4f5f0a75;p=thirdparty%2Ffastapi%2Fsqlmodel.git Remove code examples for Python 3.9 --- diff --git a/docs_src/tutorial/str_fields_and_column_length/tutorial001_py39.py b/docs_src/tutorial/str_fields_and_column_length/tutorial001_py39.py deleted file mode 100644 index ff3348358..000000000 --- a/docs_src/tutorial/str_fields_and_column_length/tutorial001_py39.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Optional - -from sqlmodel import Field, SQLModel, create_engine - - -class Hero(SQLModel, table=True): - id: Optional[int] = Field(default=None, primary_key=True) - name: str - - -database_url = "mysql://user:password@localhost/dbname" - -engine = create_engine(database_url, echo=True) - - -def create_db_and_tables(): - SQLModel.metadata.create_all(engine) - - -if __name__ == "__main__": - create_db_and_tables() diff --git a/docs_src/tutorial/str_fields_and_column_length/tutorial002_py39.py b/docs_src/tutorial/str_fields_and_column_length/tutorial002_py39.py deleted file mode 100644 index 32e7052b1..000000000 --- a/docs_src/tutorial/str_fields_and_column_length/tutorial002_py39.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Optional - -from sqlmodel import Field, SQLModel, create_engine - - -class Hero(SQLModel, table=True): - id: Optional[int] = Field(default=None, primary_key=True) - name: str = Field(max_length=100) - - -database_url = "mysql://user:password@localhost/dbname" - -engine = create_engine(database_url, echo=True) - - -def create_db_and_tables(): - SQLModel.metadata.create_all(engine) - - -if __name__ == "__main__": - create_db_and_tables() diff --git a/docs_src/tutorial/str_fields_and_column_length/tutorial003_py39.py b/docs_src/tutorial/str_fields_and_column_length/tutorial003_py39.py deleted file mode 100644 index 4ca5ff0f0..000000000 --- a/docs_src/tutorial/str_fields_and_column_length/tutorial003_py39.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Optional - -from sqlmodel import Field, SQLModel, String, create_engine - - -class Hero(SQLModel, table=True): - id: Optional[int] = Field(default=None, primary_key=True) - name: str = Field(sa_type=String) - - -database_url = "mysql://user:password@localhost/dbname" - -engine = create_engine(database_url, echo=True) - - -def create_db_and_tables(): - SQLModel.metadata.create_all(engine) - - -if __name__ == "__main__": - create_db_and_tables() diff --git a/docs_src/tutorial/str_fields_and_column_length/tutorial004_py39.py b/docs_src/tutorial/str_fields_and_column_length/tutorial004_py39.py deleted file mode 100644 index c1ef56ab7..000000000 --- a/docs_src/tutorial/str_fields_and_column_length/tutorial004_py39.py +++ /dev/null @@ -1,21 +0,0 @@ -from typing import Optional - -from sqlmodel import Field, SQLModel, String, create_engine - - -class Hero(SQLModel, table=True): - id: Optional[int] = Field(default=None, primary_key=True) - name: str = Field(sa_type=String(length=255)) - - -database_url = "mysql://user:password@localhost/dbname" - -engine = create_engine(database_url, echo=True) - - -def create_db_and_tables(): - SQLModel.metadata.create_all(engine) - - -if __name__ == "__main__": - create_db_and_tables() diff --git a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial001.py b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial001.py index 755457eb8..25ac2e2a3 100644 --- a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial001.py +++ b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial001.py @@ -10,8 +10,6 @@ from sqlalchemy import create_mock_engine from sqlalchemy.sql.type_api import TypeEngine from sqlmodel import create_engine -from ...conftest import needs_py310 - def mysql_dump(sql: TypeEngine, *args, **kwargs): dialect = sql.compile(dialect=mysql_engine.dialect) @@ -26,8 +24,7 @@ mysql_engine = create_mock_engine("mysql://", mysql_dump) @pytest.fixture( name="mod", params=[ - pytest.param("tutorial001_py39"), - pytest.param("tutorial001_py310", marks=needs_py310), + "tutorial001_py310", ], ) def get_module(request: pytest.FixtureRequest) -> Generator[ModuleType, None, None]: diff --git a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial002.py b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial002.py index 11be8afb7..647598e8f 100644 --- a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial002.py +++ b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial002.py @@ -10,8 +10,6 @@ from sqlalchemy import create_mock_engine from sqlalchemy.sql.type_api import TypeEngine from sqlmodel import create_engine -from ...conftest import needs_py310 - def mysql_dump(sql: TypeEngine, *args, **kwargs): dialect = sql.compile(dialect=mysql_engine.dialect) @@ -26,8 +24,7 @@ mysql_engine = create_mock_engine("mysql://", mysql_dump) @pytest.fixture( name="mod", params=[ - pytest.param("tutorial002_py39"), - pytest.param("tutorial002_py310", marks=needs_py310), + "tutorial002_py310", ], ) def get_module(request: pytest.FixtureRequest) -> Generator[ModuleType, None, None]: diff --git a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial003.py b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial003.py index 630277191..23404f9d7 100644 --- a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial003.py +++ b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial003.py @@ -11,8 +11,6 @@ from sqlalchemy.exc import CompileError from sqlalchemy.sql.type_api import TypeEngine from sqlmodel import create_engine -from ...conftest import needs_py310 - def mysql_dump(sql: TypeEngine, *args, **kwargs): dialect = sql.compile(dialect=mysql_engine.dialect) @@ -27,8 +25,7 @@ mysql_engine = create_mock_engine("mysql://", mysql_dump) @pytest.fixture( name="mod", params=[ - pytest.param("tutorial003_py39"), - pytest.param("tutorial003_py310", marks=needs_py310), + "tutorial003_py310", ], ) def get_module(request: pytest.FixtureRequest) -> Generator[ModuleType, None, None]: diff --git a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial004.py b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial004.py index f6367499c..ec024dfa6 100644 --- a/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial004.py +++ b/tests/test_tutorial/test_str_fields_and_column_length/test_tutorial004.py @@ -10,8 +10,6 @@ from sqlalchemy import create_mock_engine from sqlalchemy.sql.type_api import TypeEngine from sqlmodel import create_engine -from ...conftest import needs_py310 - def mysql_dump(sql: TypeEngine, *args, **kwargs): dialect = sql.compile(dialect=mysql_engine.dialect) @@ -26,8 +24,7 @@ mysql_engine = create_mock_engine("mysql://", mysql_dump) @pytest.fixture( name="mod", params=[ - pytest.param("tutorial004_py39"), - pytest.param("tutorial004_py310", marks=needs_py310), + "tutorial004_py310", ], ) def get_module(request: pytest.FixtureRequest) -> Generator[ModuleType, None, None]: