Skip to content

Commit

Permalink
ensure proper attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx committed Nov 7, 2024
1 parent 886e8c7 commit 3734e68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backend/danswer/db/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,14 @@ async def get_async_session_with_tenant(
yield session


@contextmanager
def get_session_with_default_tenant() -> Generator[Session, None, None]:
"""
Get a database session using the current tenant ID from the context variable.
"""
tenant_id = CURRENT_TENANT_ID_CONTEXTVAR.get()
return get_session_with_tenant(tenant_id)
with get_session_with_tenant(tenant_id) as session:
yield session


@contextmanager
Expand Down

0 comments on commit 3734e68

Please sign in to comment.