|
12 | 12 | from sqlalchemy.types import TypeDecorator |
13 | 13 | from sqlalchemy import orm, event, types, Sequence |
14 | 14 | from sqlalchemy.ext.declarative import declarative_base |
| 15 | +import warnings |
| 16 | +from sqlalchemy.exc import SAWarning |
15 | 17 |
|
| 18 | +warnings.filterwarnings("ignore", category=SAWarning) |
16 | 19 | import eyed3 |
17 | 20 | from eyed3.utils import art |
18 | 21 | from eyed3.utils import guessMimetype |
@@ -156,15 +159,15 @@ class Artist(Base, OrmObject): |
156 | 159 | nullable=False, index=True) |
157 | 160 |
|
158 | 161 | # Relations |
159 | | - albums = orm.relation("Album", cascade="all") |
| 162 | + albums = orm.relationship("Album", cascade="all") |
160 | 163 | """all albums by the artist""" |
161 | | - tracks = orm.relation("Track", cascade="all") |
| 164 | + tracks = orm.relationship("Track", cascade="all") |
162 | 165 | """all tracks by the artist""" |
163 | | - tags = orm.relation("Tag", secondary=artist_tags) |
| 166 | + tags = orm.relationship("Tag", secondary=artist_tags) |
164 | 167 | """one-to-many (artist->tag) and many-to-one (tag->artist)""" |
165 | | - images = orm.relation("Image", secondary=artist_images, cascade="all") |
| 168 | + images = orm.relationship("Image", secondary=artist_images, cascade="all") |
166 | 169 | """one-to-many artist images.""" |
167 | | - library = orm.relation("Library") |
| 170 | + library = orm.relationship("Library") |
168 | 171 |
|
169 | 172 | def getAlbumsByType(self, album_type): |
170 | 173 | if album_type == VARIOUS_TYPE: |
@@ -287,13 +290,13 @@ class Album(Base, OrmObject): |
287 | 290 | nullable=False, index=True) |
288 | 291 |
|
289 | 292 | # Relations |
290 | | - artist = orm.relation("Artist") |
291 | | - tracks = orm.relation("Track", order_by="Track.track_num", |
| 293 | + artist = orm.relationship("Artist") |
| 294 | + tracks = orm.relationship("Track", order_by="Track.track_num", |
292 | 295 | cascade="all") |
293 | | - tags = orm.relation("Tag", secondary=album_tags) |
294 | | - images = orm.relation("Image", secondary=album_images, cascade="all") |
| 296 | + tags = orm.relationship("Tag", secondary=album_tags) |
| 297 | + images = orm.relationship("Image", secondary=album_images, cascade="all") |
295 | 298 | """one-to-many album images.""" |
296 | | - library = orm.relation("Library") |
| 299 | + library = orm.relationship("Library") |
297 | 300 |
|
298 | 301 | def getBestDate(self): |
299 | 302 | from eyed3.utils import datePicker |
@@ -349,10 +352,10 @@ class Track(Base, OrmObject): |
349 | 352 | nullable=False, index=True) |
350 | 353 |
|
351 | 354 | # Relations |
352 | | - artist = orm.relation("Artist") |
353 | | - album = orm.relation("Album") |
354 | | - tags = orm.relation("Tag", secondary=track_tags) |
355 | | - library = orm.relation("Library") |
| 355 | + artist = orm.relationship("Artist") |
| 356 | + album = orm.relationship("Album") |
| 357 | + tags = orm.relationship("Tag", secondary=track_tags) |
| 358 | + library = orm.relationship("Library") |
356 | 359 |
|
357 | 360 | # XXX: test-only |
358 | 361 | _mp3_file = None |
@@ -419,7 +422,7 @@ class Tag(Base, OrmObject): |
419 | 422 | nullable=False, index=True) |
420 | 423 |
|
421 | 424 | # Relations |
422 | | - library = orm.relation("Library") |
| 425 | + library = orm.relationship("Library") |
423 | 426 |
|
424 | 427 | @orm.validates("name") |
425 | 428 | def _truncateName(self, key, value): |
|
0 commit comments