fix: use new syntax
This commit is contained in:
parent
17e3c97e6b
commit
98f62adfc9
@ -27,6 +27,8 @@ from models.provider import Provider, ProviderModel
|
|||||||
from services.account_service import RegisterService, TenantService
|
from services.account_service import RegisterService, TenantService
|
||||||
from services.plugin.data_migration import PluginDataMigration
|
from services.plugin.data_migration import PluginDataMigration
|
||||||
from services.plugin.plugin_migration import PluginMigration
|
from services.plugin.plugin_migration import PluginMigration
|
||||||
|
from sqlalchemy.orm import Session
|
||||||
|
from sqlalchemy import select
|
||||||
|
|
||||||
|
|
||||||
@click.command("reset-password", help="Reset the account password.")
|
@click.command("reset-password", help="Reset the account password.")
|
||||||
@ -160,11 +162,12 @@ def migrate_annotation_vector_database():
|
|||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# get apps info
|
# get apps info
|
||||||
apps = (
|
with Session(db.engine) as session:
|
||||||
App.query.filter(App.status == "normal")
|
query = select(App).where(App.status == "normal").order_by(App.created_at.desc())
|
||||||
.order_by(App.created_at.desc())
|
apps = session.execute(query).scalars().all()
|
||||||
.paginate(page=page, per_page=50)
|
start = (page - 1) * 50
|
||||||
)
|
end = start + 50
|
||||||
|
apps = apps[start:end]
|
||||||
except NotFound:
|
except NotFound:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user