From ae87ac82baebf6ec416736ed3819cd5d208b8db4 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sat, 14 Oct 2023 17:05:10 +0100 Subject: [PATCH] Migrate model to SQLAlchemy 2.0 DeclarativeBase --- app/dbconfig.py | 2 +- app/models.py | 120 +++++++++-------- ...ab_migrate_sqla_2_and_remove_redundant_.py | 72 ++++++++++ poetry.lock | 127 +++++++++--------- pyproject.toml | 4 +- 5 files changed, 202 insertions(+), 123 deletions(-) create mode 100644 migrations/versions/3a53a9fb26ab_migrate_sqla_2_and_remove_redundant_.py diff --git a/app/dbconfig.py b/app/dbconfig.py index 8e794fe..85127b5 100644 --- a/app/dbconfig.py +++ b/app/dbconfig.py @@ -30,10 +30,10 @@ else: engine = create_engine( MYSQL_CONNECT, - encoding="utf-8", echo=Config.DISPLAY_SQL, pool_pre_ping=True, future=True, + connect_args={"encoding": "utf-8"}, ) diff --git a/app/models.py b/app/models.py index e6b6caa..22ab99b 100644 --- a/app/models.py +++ b/app/models.py @@ -12,21 +12,21 @@ from sqlalchemy.ext.associationproxy import association_proxy from sqlalchemy import ( Boolean, - Column, DateTime, delete, - Float, ForeignKey, func, - Integer, select, String, update, ) from sqlalchemy.orm import ( - declarative_base, + DeclarativeBase, joinedload, + lazyload, + Mapped, + mapped_column, relationship, ) from sqlalchemy.orm.exc import ( @@ -37,19 +37,21 @@ from sqlalchemy.exc import ( ) from log import log -Base = declarative_base() + +class Base(DeclarativeBase): + pass # Database classes class Carts(Base): __tablename__ = "carts" - id: int = Column(Integer, primary_key=True, autoincrement=True) - cart_number: int = Column(Integer, nullable=False, unique=True) - name = Column(String(256), index=True) - duration = Column(Integer, index=True) - path = Column(String(2048), index=False) - enabled: bool = Column(Boolean, default=False, nullable=False) + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + cart_number: Mapped[int] = mapped_column(unique=True) + name: Mapped[str] = mapped_column(String(256), index=True) + duration: Mapped[int] = mapped_column(index=True) + path: Mapped[str] = mapped_column(String(2048), index=False) + enabled: Mapped[bool] = mapped_column(default=False) def __repr__(self) -> str: return ( @@ -81,13 +83,13 @@ class Carts(Base): class NoteColours(Base): __tablename__ = "notecolours" - id = Column(Integer, primary_key=True, autoincrement=True) - substring = Column(String(256), index=False) - colour = Column(String(21), index=False) - enabled = Column(Boolean, default=True, index=True) - is_regex = Column(Boolean, default=False, index=False) - is_casesensitive = Column(Boolean, default=False, index=False) - order = Column(Integer, index=True) + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + substring: Mapped[str] = mapped_column(String(256), index=False) + colour: Mapped[str] = mapped_column(String(21), index=False) + enabled: Mapped[bool] = mapped_column(default=True, index=True) + is_regex: Mapped[bool] = mapped_column(default=False, index=False) + is_casesensitive: Mapped[bool] = mapped_column(default=False, index=False) + order: Mapped[Optional[int]] = mapped_column(index=True) def __repr__(self) -> str: return ( @@ -134,10 +136,10 @@ class NoteColours(Base): class Playdates(Base): __tablename__ = "playdates" - id: int = Column(Integer, primary_key=True, autoincrement=True) - lastplayed: datetime = Column(DateTime, index=True) - track_id = Column(Integer, ForeignKey("tracks.id")) - track: "Tracks" = relationship("Tracks", back_populates="playdates") + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + lastplayed: Mapped[datetime] = mapped_column(index=True) + track_id: Mapped[int] = mapped_column(ForeignKey("tracks.id")) + track: Mapped["Tracks"] = relationship("Tracks", back_populates="playdates") def __repr__(self) -> str: return ( @@ -191,16 +193,13 @@ class Playlists(Base): __tablename__ = "playlists" - id = Column(Integer, primary_key=True, autoincrement=True, nullable=False) - name: str = Column(String(32), nullable=False, unique=True) - last_used = Column(DateTime, default=None, nullable=True) - tab = Column(Integer, default=None, nullable=True, unique=True) - # TODO sort_column is unused - sort_column = Column(Integer, default=None, nullable=True, unique=False) - is_template: bool = Column(Boolean, default=False, nullable=False) - query = Column(String(256), default=None, nullable=True, unique=False) - deleted: bool = Column(Boolean, default=False, nullable=False) - rows: List["PlaylistRows"] = relationship( + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + name: Mapped[str] = mapped_column(String(32), unique=True) + last_used: Mapped[Optional[datetime]] = mapped_column(DateTime, default=None) + tab: Mapped[Optional[int]] = mapped_column(default=None, unique=True) + is_template: Mapped[bool] = mapped_column(default=False) + deleted: Mapped[bool] = mapped_column(default=False) + rows: Mapped[List["PlaylistRows"]] = relationship( "PlaylistRows", back_populates="playlist", cascade="all, delete-orphan", @@ -359,14 +358,17 @@ class Playlists(Base): class PlaylistRows(Base): __tablename__ = "playlist_rows" - id: int = Column(Integer, primary_key=True, autoincrement=True) - plr_rownum: int = Column(Integer, nullable=False) - note: str = Column(String(2048), index=False, default="", nullable=False) - playlist_id: int = Column(Integer, ForeignKey("playlists.id"), nullable=False) - playlist: Playlists = relationship(Playlists, back_populates="rows") - track_id = Column(Integer, ForeignKey("tracks.id"), nullable=True) - track: "Tracks" = relationship("Tracks", back_populates="playlistrows") - played: bool = Column(Boolean, nullable=False, index=False, default=False) + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + plr_rownum: Mapped[int] + note: Mapped[str] = mapped_column(String(2048), index=False, default="", nullable=False) + playlist_id: Mapped[int] = mapped_column(ForeignKey("playlists.id")) + playlist: Mapped[Playlists] = relationship(back_populates="rows") + track_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tracks.id")) + track: Mapped["Tracks"] = relationship( + "Tracks", + back_populates="playlistrows", + ) + played: Mapped[bool] = mapped_column(Boolean, nullable=False, index=False, default=False) def __repr__(self) -> str: return ( @@ -596,11 +598,11 @@ class Settings(Base): __tablename__ = "settings" - id: int = Column(Integer, primary_key=True, autoincrement=True) - name: str = Column(String(64), nullable=False, unique=True) - f_datetime = Column(DateTime, default=None, nullable=True) - f_int: int = Column(Integer, default=None, nullable=True) - f_string = Column(String(128), default=None, nullable=True) + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + name: Mapped[str] = mapped_column(String(64), unique=True) + f_datetime: Mapped[Optional[datetime]] = mapped_column(default=None) + f_int: Mapped[Optional[int]] = mapped_column(default=None) + f_string: Mapped[Optional[str]] = mapped_column(String(128), default=None) def __repr__(self) -> str: value = self.f_datetime or self.f_int or self.f_string @@ -631,21 +633,25 @@ class Settings(Base): class Tracks(Base): __tablename__ = "tracks" - id: int = Column(Integer, primary_key=True, autoincrement=True) - title = Column(String(256), index=True) - artist = Column(String(256), index=True) - duration = Column(Integer, index=True) - start_gap = Column(Integer, index=False) - fade_at = Column(Integer, index=False) - silence_at = Column(Integer, index=False) - path: str = Column(String(2048), index=False, nullable=False, unique=True) - mtime = Column(Float, index=True) - bitrate = Column(Integer, nullable=True, default=None) - playlistrows: List[PlaylistRows] = relationship( + id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True) + title: Mapped[str] = mapped_column(String(256), index=True) + artist: Mapped[str] = mapped_column(String(256), index=True) + duration: Mapped[int] = mapped_column(index=True) + start_gap: Mapped[int] = mapped_column(index=False) + fade_at: Mapped[int] = mapped_column(index=False) + silence_at: Mapped[int] = mapped_column(index=False) + path: Mapped[str] = mapped_column(String(2048), index=False, unique=True) + mtime: Mapped[float] = mapped_column(index=True) + bitrate: Mapped[Optional[int]] = mapped_column(default=None) + playlistrows: Mapped[List[PlaylistRows]] = relationship( "PlaylistRows", back_populates="track" ) playlists = association_proxy("playlistrows", "playlist") - playdates: List[Playdates] = relationship("Playdates", back_populates="track") + playdates: Mapped[List[Playdates]] = relationship( + "Playdates", + back_populates="track", + lazy="joined", + ) def __repr__(self) -> str: return ( diff --git a/migrations/versions/3a53a9fb26ab_migrate_sqla_2_and_remove_redundant_.py b/migrations/versions/3a53a9fb26ab_migrate_sqla_2_and_remove_redundant_.py new file mode 100644 index 0000000..336c0e4 --- /dev/null +++ b/migrations/versions/3a53a9fb26ab_migrate_sqla_2_and_remove_redundant_.py @@ -0,0 +1,72 @@ +"""Migrate SQLA 2 and remove redundant columns + +Revision ID: 3a53a9fb26ab +Revises: 07dcbe6c4f0e +Create Date: 2023-10-15 09:39:16.449419 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '3a53a9fb26ab' +down_revision = '07dcbe6c4f0e' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('playlists', 'query') + op.drop_column('playlists', 'sort_column') + op.alter_column('tracks', 'title', + existing_type=mysql.VARCHAR(length=256), + nullable=False) + op.alter_column('tracks', 'artist', + existing_type=mysql.VARCHAR(length=256), + nullable=False) + op.alter_column('tracks', 'duration', + existing_type=mysql.INTEGER(display_width=11), + nullable=False) + op.alter_column('tracks', 'start_gap', + existing_type=mysql.INTEGER(display_width=11), + nullable=False) + op.alter_column('tracks', 'fade_at', + existing_type=mysql.INTEGER(display_width=11), + nullable=False) + op.alter_column('tracks', 'silence_at', + existing_type=mysql.INTEGER(display_width=11), + nullable=False) + op.alter_column('tracks', 'mtime', + existing_type=mysql.FLOAT(), + nullable=False) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.alter_column('tracks', 'mtime', + existing_type=mysql.FLOAT(), + nullable=True) + op.alter_column('tracks', 'silence_at', + existing_type=mysql.INTEGER(display_width=11), + nullable=True) + op.alter_column('tracks', 'fade_at', + existing_type=mysql.INTEGER(display_width=11), + nullable=True) + op.alter_column('tracks', 'start_gap', + existing_type=mysql.INTEGER(display_width=11), + nullable=True) + op.alter_column('tracks', 'duration', + existing_type=mysql.INTEGER(display_width=11), + nullable=True) + op.alter_column('tracks', 'artist', + existing_type=mysql.VARCHAR(length=256), + nullable=True) + op.alter_column('tracks', 'title', + existing_type=mysql.VARCHAR(length=256), + nullable=True) + op.add_column('playlists', sa.Column('sort_column', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True)) + op.add_column('playlists', sa.Column('query', mysql.VARCHAR(length=256), nullable=True)) + # ### end Alembic commands ### diff --git a/poetry.lock b/poetry.lock index c4b1032..b97a888 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1858,88 +1858,91 @@ test = ["pytest"] [[package]] name = "sqlalchemy" -version = "1.4.49" +version = "2.0.22" description = "Database Abstraction Library" category = "main" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +python-versions = ">=3.7" files = [ - {file = "SQLAlchemy-1.4.49-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:95b9df9afd680b7a3b13b38adf6e3a38995da5e162cc7524ef08e3be4e5ed3e1"}, - {file = "SQLAlchemy-1.4.49-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a63e43bf3f668c11bb0444ce6e809c1227b8f067ca1068898f3008a273f52b09"}, - {file = "SQLAlchemy-1.4.49-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:f835c050ebaa4e48b18403bed2c0fda986525896efd76c245bdd4db995e51a4c"}, - {file = "SQLAlchemy-1.4.49-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9c21b172dfb22e0db303ff6419451f0cac891d2e911bb9fbf8003d717f1bcf91"}, - {file = "SQLAlchemy-1.4.49-cp310-cp310-win32.whl", hash = "sha256:5fb1ebdfc8373b5a291485757bd6431de8d7ed42c27439f543c81f6c8febd729"}, - {file = "SQLAlchemy-1.4.49-cp310-cp310-win_amd64.whl", hash = "sha256:f8a65990c9c490f4651b5c02abccc9f113a7f56fa482031ac8cb88b70bc8ccaa"}, - {file = "SQLAlchemy-1.4.49-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:8923dfdf24d5aa8a3adb59723f54118dd4fe62cf59ed0d0d65d940579c1170a4"}, - {file = "SQLAlchemy-1.4.49-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a9ab2c507a7a439f13ca4499db6d3f50423d1d65dc9b5ed897e70941d9e135b0"}, - {file = "SQLAlchemy-1.4.49-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5debe7d49b8acf1f3035317e63d9ec8d5e4d904c6e75a2a9246a119f5f2fdf3d"}, - {file = "SQLAlchemy-1.4.49-cp311-cp311-win32.whl", hash = "sha256:82b08e82da3756765c2e75f327b9bf6b0f043c9c3925fb95fb51e1567fa4ee87"}, - {file = "SQLAlchemy-1.4.49-cp311-cp311-win_amd64.whl", hash = "sha256:171e04eeb5d1c0d96a544caf982621a1711d078dbc5c96f11d6469169bd003f1"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:36e58f8c4fe43984384e3fbe6341ac99b6b4e083de2fe838f0fdb91cebe9e9cb"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b31e67ff419013f99ad6f8fc73ee19ea31585e1e9fe773744c0f3ce58c039c30"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c14b29d9e1529f99efd550cd04dbb6db6ba5d690abb96d52de2bff4ed518bc95"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c40f3470e084d31247aea228aa1c39bbc0904c2b9ccbf5d3cfa2ea2dac06f26d"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-win32.whl", hash = "sha256:706bfa02157b97c136547c406f263e4c6274a7b061b3eb9742915dd774bbc264"}, - {file = "SQLAlchemy-1.4.49-cp36-cp36m-win_amd64.whl", hash = "sha256:a7f7b5c07ae5c0cfd24c2db86071fb2a3d947da7bd487e359cc91e67ac1c6d2e"}, - {file = "SQLAlchemy-1.4.49-cp37-cp37m-macosx_11_0_x86_64.whl", hash = "sha256:4afbbf5ef41ac18e02c8dc1f86c04b22b7a2125f2a030e25bbb4aff31abb224b"}, - {file = "SQLAlchemy-1.4.49-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:201de072b818f8ad55c80d18d1a788729cccf9be6d9dc3b9d8613b053cd4836d"}, - {file = "SQLAlchemy-1.4.49-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7653ed6817c710d0c95558232aba799307d14ae084cc9b1f4c389157ec50df5c"}, - {file = "SQLAlchemy-1.4.49-cp37-cp37m-win32.whl", hash = "sha256:647e0b309cb4512b1f1b78471fdaf72921b6fa6e750b9f891e09c6e2f0e5326f"}, - {file = "SQLAlchemy-1.4.49-cp37-cp37m-win_amd64.whl", hash = "sha256:ab73ed1a05ff539afc4a7f8cf371764cdf79768ecb7d2ec691e3ff89abbc541e"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:37ce517c011560d68f1ffb28af65d7e06f873f191eb3a73af5671e9c3fada08a"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1878ce508edea4a879015ab5215546c444233881301e97ca16fe251e89f1c55"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:0e8e608983e6f85d0852ca61f97e521b62e67969e6e640fe6c6b575d4db68557"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ccf956da45290df6e809ea12c54c02ace7f8ff4d765d6d3dfb3655ee876ce58d"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-win32.whl", hash = "sha256:f167c8175ab908ce48bd6550679cc6ea20ae169379e73c7720a28f89e53aa532"}, - {file = "SQLAlchemy-1.4.49-cp38-cp38-win_amd64.whl", hash = "sha256:45806315aae81a0c202752558f0df52b42d11dd7ba0097bf71e253b4215f34f4"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:b6d0c4b15d65087738a6e22e0ff461b407533ff65a73b818089efc8eb2b3e1de"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a843e34abfd4c797018fd8d00ffffa99fd5184c421f190b6ca99def4087689bd"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1c890421651b45a681181301b3497e4d57c0d01dc001e10438a40e9a9c25ee77"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d26f280b8f0a8f497bc10573849ad6dc62e671d2468826e5c748d04ed9e670d5"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-win32.whl", hash = "sha256:ec2268de67f73b43320383947e74700e95c6770d0c68c4e615e9897e46296294"}, - {file = "SQLAlchemy-1.4.49-cp39-cp39-win_amd64.whl", hash = "sha256:bbdf16372859b8ed3f4d05f925a984771cd2abd18bd187042f24be4886c2a15f"}, - {file = "SQLAlchemy-1.4.49.tar.gz", hash = "sha256:06ff25cbae30c396c4b7737464f2a7fc37a67b7da409993b182b024cec80aed9"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:f146c61ae128ab43ea3a0955de1af7e1633942c2b2b4985ac51cc292daf33222"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:875de9414393e778b655a3d97d60465eb3fae7c919e88b70cc10b40b9f56042d"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:13790cb42f917c45c9c850b39b9941539ca8ee7917dacf099cc0b569f3d40da7"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e04ab55cf49daf1aeb8c622c54d23fa4bec91cb051a43cc24351ba97e1dd09f5"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:a42c9fa3abcda0dcfad053e49c4f752eef71ecd8c155221e18b99d4224621176"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:14cd3bcbb853379fef2cd01e7c64a5d6f1d005406d877ed9509afb7a05ff40a5"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-win32.whl", hash = "sha256:d143c5a9dada696bcfdb96ba2de4a47d5a89168e71d05a076e88a01386872f97"}, + {file = "SQLAlchemy-2.0.22-cp310-cp310-win_amd64.whl", hash = "sha256:ccd87c25e4c8559e1b918d46b4fa90b37f459c9b4566f1dfbce0eb8122571547"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4f6ff392b27a743c1ad346d215655503cec64405d3b694228b3454878bf21590"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f776c2c30f0e5f4db45c3ee11a5f2a8d9de68e81eb73ec4237de1e32e04ae81c"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c8f1792d20d2f4e875ce7a113f43c3561ad12b34ff796b84002a256f37ce9437"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d80eeb5189d7d4b1af519fc3f148fe7521b9dfce8f4d6a0820e8f5769b005051"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:69fd9e41cf9368afa034e1c81f3570afb96f30fcd2eb1ef29cb4d9371c6eece2"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:54bcceaf4eebef07dadfde424f5c26b491e4a64e61761dea9459103ecd6ccc95"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-win32.whl", hash = "sha256:7ee7ccf47aa503033b6afd57efbac6b9e05180f492aeed9fcf70752556f95624"}, + {file = "SQLAlchemy-2.0.22-cp311-cp311-win_amd64.whl", hash = "sha256:b560f075c151900587ade06706b0c51d04b3277c111151997ea0813455378ae0"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:2c9bac865ee06d27a1533471405ad240a6f5d83195eca481f9fc4a71d8b87df8"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:625b72d77ac8ac23da3b1622e2da88c4aedaee14df47c8432bf8f6495e655de2"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b39a6e21110204a8c08d40ff56a73ba542ec60bab701c36ce721e7990df49fb9"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:53a766cb0b468223cafdf63e2d37f14a4757476157927b09300c8c5832d88560"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:0e1ce8ebd2e040357dde01a3fb7d30d9b5736b3e54a94002641dfd0aa12ae6ce"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:505f503763a767556fa4deae5194b2be056b64ecca72ac65224381a0acab7ebe"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-win32.whl", hash = "sha256:154a32f3c7b00de3d090bc60ec8006a78149e221f1182e3edcf0376016be9396"}, + {file = "SQLAlchemy-2.0.22-cp312-cp312-win_amd64.whl", hash = "sha256:129415f89744b05741c6f0b04a84525f37fbabe5dc3774f7edf100e7458c48cd"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:3940677d341f2b685a999bffe7078697b5848a40b5f6952794ffcf3af150c301"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:55914d45a631b81a8a2cb1a54f03eea265cf1783241ac55396ec6d735be14883"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2096d6b018d242a2bcc9e451618166f860bb0304f590d205173d317b69986c95"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:19c6986cf2fb4bc8e0e846f97f4135a8e753b57d2aaaa87c50f9acbe606bd1db"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:6ac28bd6888fe3c81fbe97584eb0b96804bd7032d6100b9701255d9441373ec1"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-win32.whl", hash = "sha256:cb9a758ad973e795267da334a92dd82bb7555cb36a0960dcabcf724d26299db8"}, + {file = "SQLAlchemy-2.0.22-cp37-cp37m-win_amd64.whl", hash = "sha256:40b1206a0d923e73aa54f0a6bd61419a96b914f1cd19900b6c8226899d9742ad"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3aa1472bf44f61dd27987cd051f1c893b7d3b17238bff8c23fceaef4f1133868"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:56a7e2bb639df9263bf6418231bc2a92a773f57886d371ddb7a869a24919face"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ccca778c0737a773a1ad86b68bda52a71ad5950b25e120b6eb1330f0df54c3d0"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7c6c3e9350f9fb16de5b5e5fbf17b578811a52d71bb784cc5ff71acb7de2a7f9"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:564e9f9e4e6466273dbfab0e0a2e5fe819eec480c57b53a2cdee8e4fdae3ad5f"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:af66001d7b76a3fab0d5e4c1ec9339ac45748bc4a399cbc2baa48c1980d3c1f4"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-win32.whl", hash = "sha256:9e55dff5ec115316dd7a083cdc1a52de63693695aecf72bc53a8e1468ce429e5"}, + {file = "SQLAlchemy-2.0.22-cp38-cp38-win_amd64.whl", hash = "sha256:4e869a8ff7ee7a833b74868a0887e8462445ec462432d8cbeff5e85f475186da"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9886a72c8e6371280cb247c5d32c9c8fa141dc560124348762db8a8b236f8692"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:a571bc8ac092a3175a1d994794a8e7a1f2f651e7c744de24a19b4f740fe95034"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8db5ba8b7da759b727faebc4289a9e6a51edadc7fc32207a30f7c6203a181592"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b0b3f2686c3f162123adba3cb8b626ed7e9b8433ab528e36ed270b4f70d1cdb"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0c1fea8c0abcb070ffe15311853abfda4e55bf7dc1d4889497b3403629f3bf00"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:4bb062784f37b2d75fd9b074c8ec360ad5df71f933f927e9e95c50eb8e05323c"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-win32.whl", hash = "sha256:58a3aba1bfb32ae7af68da3f277ed91d9f57620cf7ce651db96636790a78b736"}, + {file = "SQLAlchemy-2.0.22-cp39-cp39-win_amd64.whl", hash = "sha256:92e512a6af769e4725fa5b25981ba790335d42c5977e94ded07db7d641490a85"}, + {file = "SQLAlchemy-2.0.22-py3-none-any.whl", hash = "sha256:3076740335e4aaadd7deb3fe6dcb96b3015f1613bd190a4e1634e1b99b02ec86"}, + {file = "SQLAlchemy-2.0.22.tar.gz", hash = "sha256:5434cc601aa17570d79e5377f5fd45ff92f9379e2abed0be5e8c2fba8d353d2b"}, ] [package.dependencies] -greenlet = {version = "!=0.4.17", markers = "python_version >= \"3\" and (platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\")"} +greenlet = {version = "!=0.4.17", markers = "platform_machine == \"aarch64\" or platform_machine == \"ppc64le\" or platform_machine == \"x86_64\" or platform_machine == \"amd64\" or platform_machine == \"AMD64\" or platform_machine == \"win32\" or platform_machine == \"WIN32\""} +typing-extensions = ">=4.2.0" [package.extras] -aiomysql = ["aiomysql", "greenlet (!=0.4.17)"] +aiomysql = ["aiomysql (>=0.2.0)", "greenlet (!=0.4.17)"] aiosqlite = ["aiosqlite", "greenlet (!=0.4.17)", "typing-extensions (!=3.10.0.1)"] asyncio = ["greenlet (!=0.4.17)"] -asyncmy = ["asyncmy (>=0.2.3,!=0.2.4)", "greenlet (!=0.4.17)"] -mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2)"] +asyncmy = ["asyncmy (>=0.2.3,!=0.2.4,!=0.2.6)", "greenlet (!=0.4.17)"] +mariadb-connector = ["mariadb (>=1.0.1,!=1.1.2,!=1.1.5)"] mssql = ["pyodbc"] mssql-pymssql = ["pymssql"] mssql-pyodbc = ["pyodbc"] -mypy = ["mypy (>=0.910)", "sqlalchemy2-stubs"] -mysql = ["mysqlclient (>=1.4.0)", "mysqlclient (>=1.4.0,<2)"] +mypy = ["mypy (>=0.910)"] +mysql = ["mysqlclient (>=1.4.0)"] mysql-connector = ["mysql-connector-python"] -oracle = ["cx-oracle (>=7)", "cx-oracle (>=7,<8)"] +oracle = ["cx-oracle (>=7)"] +oracle-oracledb = ["oracledb (>=1.0.1)"] postgresql = ["psycopg2 (>=2.7)"] postgresql-asyncpg = ["asyncpg", "greenlet (!=0.4.17)"] -postgresql-pg8000 = ["pg8000 (>=1.16.6,!=1.29.0)"] +postgresql-pg8000 = ["pg8000 (>=1.29.1)"] +postgresql-psycopg = ["psycopg (>=3.0.7)"] postgresql-psycopg2binary = ["psycopg2-binary"] postgresql-psycopg2cffi = ["psycopg2cffi"] -pymysql = ["pymysql", "pymysql (<1)"] +postgresql-psycopgbinary = ["psycopg[binary] (>=3.0.7)"] +pymysql = ["pymysql"] sqlcipher = ["sqlcipher3-binary"] -[[package]] -name = "sqlalchemy2-stubs" -version = "0.0.2a35" -description = "Typing Stubs for SQLAlchemy 1.4" -category = "dev" -optional = false -python-versions = ">=3.6" -files = [ - {file = "sqlalchemy2-stubs-0.0.2a35.tar.gz", hash = "sha256:bd5d530697d7e8c8504c7fe792ef334538392a5fb7aa7e4f670bfacdd668a19d"}, - {file = "sqlalchemy2_stubs-0.0.2a35-py3-none-any.whl", hash = "sha256:593784ff9fc0dc2ded1895e3322591689db3be06f3ca006e3ef47640baf2d38a"}, -] - -[package.dependencies] -typing-extensions = ">=3.7.4" - [[package]] name = "stack-data" version = "0.6.2" @@ -2171,4 +2174,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.9" -content-hash = "068d52d54597c5fbb5ccbb168ed5b1b76300c5df8621859d7d9b915dbda6e326" +content-hash = "b9312f2126e81b0d924d6f1ae5c73d49f45c74c046cc6dfc18be391f23c04f07" diff --git a/pyproject.toml b/pyproject.toml index d83aeae..8e6ad7e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ authors = ["Keith Edmunds "] [tool.poetry.dependencies] python = "^3.9" tinytag = "^1.7.0" -SQLAlchemy = "^1.4.31" +SQLAlchemy = "^2.0.22" python-vlc = "^3.0.12118" mysqlclient = "^2.1.0" mutagen = "^1.45.1" @@ -35,7 +35,6 @@ pytest-qt = "^4.0.2" pydub-stubs = "^0.25.1" line-profiler = "^4.0.2" flakehell = "^0.9.0" -sqlalchemy2-stubs = "^0.0.2-alpha.32" mypy = "^0.991" [tool.poetry.group.dev.dependencies] @@ -52,7 +51,6 @@ build-backend = "poetry.core.masonry.api" [tool.mypy] # mypy_path = "/home/kae/.cache/pypoetry/virtualenvs/musicmuster-oWgGw1IG-py3.9:/home/kae/git/musicmuster/app" mypy_path = "/home/kae/git/musicmuster/app" -plugins = "sqlalchemy.ext.mypy.plugin" [tool.vulture] exclude = ["migrations", "app/ui", "archive"]