2
2
from typing import List
3
3
4
4
from sqlalchemy import Column , ForeignKey , Table , create_engine , types
5
- from sqlalchemy .orm import Mapped
5
+ from sqlalchemy .ext . declarative import declarative_base
6
6
from sqlalchemy .orm import Session as DbSession
7
- from sqlalchemy .orm import backref , declarative_base , relationship , sessionmaker
7
+ from sqlalchemy .orm import backref , relationship , sessionmaker
8
8
9
9
SCHEMA = """
10
10
create table sessions (
@@ -131,10 +131,8 @@ class Asset(Base):
131
131
normalized_name = Column (types .Text , nullable = False )
132
132
size = Column (types .Integer , nullable = False )
133
133
134
- session = relationship (Session , backref = backref ("assets" ))
135
- chunks : Mapped [List ["Chunk" ]] = relationship (
136
- secondary = assets_chunks , back_populates = "assets"
137
- )
134
+ session = relationship ("Session" , backref = backref ("assets" ))
135
+ chunks = relationship ("Chunk" , secondary = assets_chunks , back_populates = "assets" )
138
136
139
137
140
138
class Chunk (Base ):
@@ -150,12 +148,8 @@ class Chunk(Base):
150
148
entry = Column (types .Boolean , nullable = False )
151
149
initial = Column (types .Boolean , nullable = False )
152
150
153
- assets : Mapped [List ["Asset" ]] = relationship (
154
- secondary = assets_chunks , back_populates = "chunks"
155
- )
156
- modules : Mapped [List ["Module" ]] = relationship (
157
- secondary = chunks_modules , back_populates = "chunks"
158
- )
151
+ assets = relationship ("Asset" , secondary = assets_chunks , back_populates = "chunks" )
152
+ modules = relationship ("Module" , secondary = chunks_modules , back_populates = "chunks" )
159
153
160
154
161
155
class Module (Base ):
@@ -169,9 +163,7 @@ class Module(Base):
169
163
name = Column (types .Text , nullable = False )
170
164
size = Column (types .Integer , nullable = False )
171
165
172
- chunks : Mapped [List ["Chunk" ]] = relationship (
173
- secondary = chunks_modules , back_populates = "modules"
174
- )
166
+ chunks = relationship ("Chunk" , secondary = chunks_modules , back_populates = "modules" )
175
167
176
168
177
169
class MetadataKey (Enum ):
0 commit comments