replace db with sa to get typing support (#23240)

This commit is contained in:
Asuka Minato
2025-08-03 00:54:23 +09:00
committed by GitHub
parent ff9fd0cdb2
commit 58608f51da
17 changed files with 623 additions and 613 deletions

View File

@@ -3,6 +3,7 @@ import time
from collections.abc import Callable
import click
import sqlalchemy as sa
from celery import shared_task # type: ignore
from sqlalchemy import delete
from sqlalchemy.exc import SQLAlchemyError
@@ -331,7 +332,7 @@ def _delete_trace_app_configs(tenant_id: str, app_id: str):
def _delete_records(query_sql: str, params: dict, delete_func: Callable, name: str) -> None:
while True:
with db.engine.begin() as conn:
rs = conn.execute(db.text(query_sql), params)
rs = conn.execute(sa.text(query_sql), params)
if rs.rowcount == 0:
break