Skip to content

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

Merged
merged 2 commits into from
May 4, 2025
Merged

Fix non-default schema in KV store #4655

merged 2 commits into from
May 4, 2025

Conversation

Weves
Copy link
Contributor

@Weves Weves commented May 2, 2025

Description

Previously, if you set the POSTGRES_DEFAULT_SCHEMA env variable, it wouldn't be respected in PgRedisKVStore, 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.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Weves Weves requested a review from a team as a code owner May 2, 2025 17:22
Copy link

vercel bot commented May 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2025 9:11pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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?
Copy link
Contributor Author

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(
Copy link
Contributor Author

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

@Weves Weves force-pushed the chris/dan-1938 branch from cc21604 to cf62c45 Compare May 4, 2025 21:05
@Weves Weves enabled auto-merge May 4, 2025 21:05
@Weves Weves added this pull request to the merge queue May 4, 2025
Merged via the queue into main with commit 7763e2f May 4, 2025
11 checks passed
@Weves Weves deleted the chris/dan-1938 branch May 4, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants