mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-07 19:38:19 +02:00
k
This commit is contained in:
parent
75c5de802b
commit
c7dc0e9af0
@ -297,10 +297,13 @@ def get_session_with_tenant(
|
||||
) -> Generator[Session, None, None]:
|
||||
"""Generate a database session bound to a connection with the appropriate tenant schema set."""
|
||||
engine = get_sqlalchemy_engine()
|
||||
event.listen(engine, "checkout", set_search_path_on_checkout)
|
||||
|
||||
if tenant_id is None:
|
||||
tenant_id = current_tenant_id.get()
|
||||
else:
|
||||
current_tenant_id.set(tenant_id)
|
||||
|
||||
event.listen(engine, "checkout", set_search_path_on_checkout)
|
||||
|
||||
if not is_valid_schema_name(tenant_id):
|
||||
raise HTTPException(status_code=400, detail="Invalid tenant ID")
|
||||
|
Loading…
x
Reference in New Issue
Block a user