-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix non-default schema in KV store #4655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR simplifies the key-value store implementation by removing custom session management and tenant-specific logic, while ensuring proper schema handling through the standard session context manager.
- Removes unnecessary tenant_id tracking and custom _get_session() context manager in
/backend/onyx/key_value_store/store.py
- Simplifies Redis client initialization by using get_redis_client() directly instead of custom tenant-specific logic
- Ensures proper schema handling by using standard get_session_context_manager() instead of explicit schema setting
- Maintains backward compatibility with existing KV store functionality while reducing code complexity
1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
@@ -189,45 +190,6 @@ class SqlEngine: | |||
_lock: threading.Lock = threading.Lock() | |||
_app_name: str = POSTGRES_UNKNOWN_APP_NAME | |||
|
|||
# NOTE(rkuo) - this appears to be unused, clean it up? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not used, was moved into the init_engine
function
@@ -430,33 +380,6 @@ def _set_search_path( | |||
) | |||
|
|||
|
|||
@asynccontextmanager | |||
async def get_async_session_with_tenant( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replaced with get_async_session_context_manager
Description
Previously, if you set the
POSTGRES_DEFAULT_SCHEMA
env variable, it wouldn't be respected inPgRedisKVStore
, which causes issues.Fixes https://linear.app/danswer/issue/DAN-1938/use-correct-schema-in-kv-store
How Has This Been Tested?
Tested different schema locally.
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.