Skip to content

Commit

Permalink
Merge pull request #3131 from danswer-ai/bugfix/session_text
Browse files Browse the repository at this point in the history
use text()
  • Loading branch information
rkuo-danswer authored Nov 14, 2024
2 parents 7c84105 + 65a205d commit 21d5cc4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions backend/danswer/db/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@ async def get_async_session_with_tenant(
await session.execute(text(f'SET search_path = "{tenant_id}"'))
if POSTGRES_IDLE_SESSIONS_TIMEOUT:
await session.execute(
f"SET SESSION idle_in_transaction_session_timeout = {POSTGRES_IDLE_SESSIONS_TIMEOUT}"
text(
f"SET SESSION idle_in_transaction_session_timeout = {POSTGRES_IDLE_SESSIONS_TIMEOUT}"
)
)
except Exception:
logger.exception("Error setting search_path.")
Expand Down Expand Up @@ -380,7 +382,9 @@ def get_session_with_tenant(
cursor.execute(f'SET search_path = "{tenant_id}"')
if POSTGRES_IDLE_SESSIONS_TIMEOUT:
cursor.execute(
f"SET SESSION idle_in_transaction_session_timeout = {POSTGRES_IDLE_SESSIONS_TIMEOUT}"
text(
f"SET SESSION idle_in_transaction_session_timeout = {POSTGRES_IDLE_SESSIONS_TIMEOUT}"
)
)
finally:
cursor.close()
Expand Down

0 comments on commit 21d5cc4

Please sign in to comment.