Skip to content

Commit

Permalink
fix: remove unused import
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiryous committed Sep 26, 2024
1 parent 4ada842 commit 6e9abc6
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions keep/api/core/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
import pymysql
from dotenv import find_dotenv, load_dotenv
from google.cloud.sql.connector import Connector
from sqlalchemy import String, cast, func
from sqlalchemy.sql.elements import Label
from sqlalchemy.sql.sqltypes import String
from sqlalchemy import func
from sqlmodel import Session, create_engine

# This import is required to create the tables
Expand Down Expand Up @@ -174,12 +172,12 @@ def get_json_extract_field(session, base_field, key):
def get_aggreated_field(session: Session, column_name: str, alias: str):
if session.bind is None:
raise ValueError("Session is not bound to a database")

if session.bind.dialect.name == "postgresql":
return func.array_agg(column_name).label(alias)
elif session.bind.dialect.name == "mysql":
return func.json_arrayagg(column_name).label(alias)
elif session.bind.dialect.name == "sqlite":
return func.group_concat(column_name).label(alias)
else:
return func.array_agg(column_name).label(alias)
return func.array_agg(column_name).label(alias)

0 comments on commit 6e9abc6

Please sign in to comment.