mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-03 20:13:02 +00:00
close a connection
This commit is contained in:
@@ -56,3 +56,8 @@
|
|||||||
then artist B is similar to A with the same weight, unless overwritten.
|
then artist B is similar to A with the same weight, unless overwritten.
|
||||||
- Figure out how to update album/artist tables instead of deleting all rows when the app starts
|
- Figure out how to update album/artist tables instead of deleting all rows when the app starts
|
||||||
- Move get all filtering and sorting operations to the database since all sort keys are table columns
|
- Move get all filtering and sorting operations to the database since all sort keys are table columns
|
||||||
|
|
||||||
|
- Paginate the following endpoints:
|
||||||
|
1. Folder tracks
|
||||||
|
2. Playlist tracks
|
||||||
|
|
||||||
+4
-1
@@ -12,6 +12,7 @@ from sqlalchemy import event
|
|||||||
from sqlalchemy.orm import (
|
from sqlalchemy.orm import (
|
||||||
DeclarativeBase,
|
DeclarativeBase,
|
||||||
MappedAsDataclass,
|
MappedAsDataclass,
|
||||||
|
Session
|
||||||
)
|
)
|
||||||
|
|
||||||
from app.db.engine import DbEngine
|
from app.db.engine import DbEngine
|
||||||
@@ -27,6 +28,8 @@ class DbManager:
|
|||||||
def __init__(self, commit: bool = False):
|
def __init__(self, commit: bool = False):
|
||||||
self.commit = commit
|
self.commit = commit
|
||||||
self.conn = DbEngine.engine.connect()
|
self.conn = DbEngine.engine.connect()
|
||||||
|
with Session(DbEngine.engine) as session:
|
||||||
|
session.connection
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self.conn.execution_options(preserve_rowcount=True)
|
return self.conn.execution_options(preserve_rowcount=True)
|
||||||
@@ -35,7 +38,7 @@ class DbManager:
|
|||||||
if self.commit:
|
if self.commit:
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
# self.conn.close()
|
self.conn.close()
|
||||||
|
|
||||||
|
|
||||||
class Base(MappedAsDataclass, DeclarativeBase):
|
class Base(MappedAsDataclass, DeclarativeBase):
|
||||||
|
|||||||
Reference in New Issue
Block a user