chore: cleanup database detection

This commit is contained in:
Andy Li
2025-07-18 17:12:56 -07:00
committed by GitHub
parent 88f7018c9c
commit 905a9dd4bb
12 changed files with 44 additions and 34 deletions

View File

@@ -13,7 +13,7 @@ from letta.schemas.identity import Identity as PydanticIdentity
from letta.schemas.identity import IdentityCreate, IdentityProperty, IdentityType, IdentityUpdate, IdentityUpsert
from letta.schemas.user import User as PydanticUser
from letta.server.db import db_registry
from letta.settings import settings
from letta.settings import DatabaseChoice, settings
from letta.utils import enforce_types
@@ -69,7 +69,7 @@ class IdentityManager:
# For SQLite compatibility: check for unique constraint violation manually
# since SQLite doesn't support postgresql_nulls_not_distinct=True
if not settings.letta_pg_uri_no_default: # Using SQLite
if settings.database_engine is DatabaseChoice.SQLITE:
# Check if an identity with the same identifier_key, project_id, and organization_id exists
query = select(IdentityModel).where(
IdentityModel.identifier_key == new_identity.identifier_key,