Skip to content

Commit 897181b

Browse files
committed
Update examples
1 parent 5325caf commit 897181b

25 files changed

+59
-7
lines changed

examples/all_of/column_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/all_of/model_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/app/models_autogenerated.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ class TEmployee(typing.Protocol):
4545
query: orm.Query
4646

4747
# Model properties
48-
id: 'sqlalchemy.Column[int]'
49-
name: 'sqlalchemy.Column[str]'
50-
division: 'sqlalchemy.Column[str]'
51-
salary: 'sqlalchemy.Column[typing.Optional[float]]'
52-
53-
def __init__(self, id: int, name: str, division: str, salary: typing.Optional[float] = None) -> None:
48+
id: "sqlalchemy.Column[int]"
49+
name: "sqlalchemy.Column[str]"
50+
division: "sqlalchemy.Column[str]"
51+
salary: "sqlalchemy.Column[typing.Optional[float]]"
52+
53+
def __init__(
54+
self, id: int, name: str, division: str, salary: typing.Optional[float] = None
55+
) -> None:
5456
"""
5557
Construct.
5658
@@ -64,7 +66,9 @@ def __init__(self, id: int, name: str, division: str, salary: typing.Optional[fl
6466
...
6567

6668
@classmethod
67-
def from_dict(cls, id: int, name: str, division: str, salary: typing.Optional[float] = None) -> "TEmployee":
69+
def from_dict(
70+
cls, id: int, name: str, division: str, salary: typing.Optional[float] = None
71+
) -> "TEmployee":
6872
"""
6973
Construct from a dictionary (eg. a POST payload).
7074

examples/composite_index/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/composite_unique/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/default/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/inheritance/joined_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/inheritance/single_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/json/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class _EmployeeDictBase(typing.TypedDict, total=True):
1315
"""TypedDict for properties that are required."""

examples/read_only/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/ref/column_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/ref/model_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class RefEmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_many/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class ProjectDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_one/backref_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_one/custom_foreign_key_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_one/kwargs_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_one/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/many_to_one/not_nullable_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/one_to_many/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class DivisionDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/relationship/one_to_one/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class PayInfoDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

examples/remote/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class _EmployeeDictBase(typing.TypedDict, total=True):
1315
"""TypedDict for properties that are required."""

examples/remote/url_models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class _EmployeeDictBase(typing.TypedDict, total=True):
1315
"""TypedDict for properties that are required."""

examples/simple/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class _EmployeeDictBase(typing.TypedDict, total=True):
1315
"""TypedDict for properties that are required."""

examples/write_only/models_auto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
from open_alchemy import models
1010

11+
Base = models.Base # type: ignore
12+
1113

1214
class EmployeeDict(typing.TypedDict, total=False):
1315
"""TypedDict for properties that are not required."""

tests/test_examples

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,5 @@ cd examples/json
6969
python models.py
7070
python models_traditional.py
7171
cd -
72+
73+
black examples

0 commit comments

Comments
 (0)