fix: correct vertex build delete function (#3289)

* refactor: Rearrange imports for clarity and consistency.

* fix: delete now executes the sql statement correctly
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-08-12 16:21:27 -03:00 committed by GitHub
commit 775d659380
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,8 +2,7 @@ from typing import Optional
from uuid import UUID
from sqlalchemy.exc import IntegrityError
from sqlmodel import Session, select, col
from sqlalchemy import delete
from sqlmodel import Session, col, delete, select
from langflow.services.database.models.vertex_builds.model import VertexBuildBase, VertexBuildTable
@ -32,5 +31,5 @@ def log_vertex_build(db: Session, vertex_build: VertexBuildBase) -> VertexBuildT
def delete_vertex_builds_by_flow_id(db: Session, flow_id: UUID) -> None:
delete(VertexBuildTable).where(VertexBuildTable.flow.has(id=flow_id)) # type: ignore
db.exec(delete(VertexBuildTable).where(VertexBuildTable.flow_id == flow_id))
db.commit()