blob: f262cd55b67a26ae88cfccda5e9812daff52823e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy.orm import registry
from sqlalchemy.types import TypeEngine
# EXPECTED_MYPY: Missing type parameters for generic type "TypeEngine"
class MyCustomType(TypeEngine):
pass
# correct way
class MyOtherCustomType(TypeEngine[str]):
pass
reg: registry = registry()
@reg.mapped
class Foo:
id: int = Column(Integer())
name = Column(MyCustomType())
other_name: str = Column(MyCustomType())
name2 = Column(MyOtherCustomType())
other_name2: str = Column(MyOtherCustomType())
Foo(name="x", other_name="x", name2="x", other_name2="x")
|