update delivery api to use custom schema / force custom schema via po…#171
Merged
bolyachevets merged 2 commits intomainfrom Jun 27, 2025
Merged
update delivery api to use custom schema / force custom schema via po…#171bolyachevets merged 2 commits intomainfrom
bolyachevets merged 2 commits intomainfrom
Conversation
…ol event listerns
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for configuring a custom database schema (DB_SCHEMA), applies that schema on connector-based and pooled SQLAlchemy connections, and updates the environment vault to surface the new schema variable.
- Introduces
DB_SCHEMAconfig and environment variable - Executes
SET search_pathimmediately after connect and on engine checkout - Adds pool options for the API service, mirrors that behavior in the delivery service
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| notify-delivery/src/notify_delivery/config.py | Added DB_SCHEMA and removed redundant DB_NAME/DB_USER lookups |
| notify-delivery/src/notify_delivery/init.py | Applies search_path on initial connect and checkout events |
| notify-delivery/devops/vaults.gcp.env | Exposed NOTIFY_DATABASE_SCHEMA in environment vault |
| notify-api/src/notify_api/init.py | Mirrors delivery service’s schema logic and adds pool options |
Comments suppressed due to low confidence (2)
notify-service/notify-delivery/devops/vaults.gcp.env:9
- Please update the README or deployment docs to document the new
NOTIFY_DATABASE_SCHEMAenvironment variable and its default value (public).
NOTIFY_DATABASE_SCHEMA="op://database/$APP_ENV/notify-db-gcp/NOTIFY_DATABASE_SCHEMA"
notify-service/notify-api/src/notify_api/init.py:70
- Indentation appears off under
if db_config.schema:—cursor = conn.cursor()should be indented one level further to be inside the block, or the block braces adjusted.
cursor = conn.cursor()
87c4778 to
dee9237
Compare
pwei1018
approved these changes
Jun 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ol event listerns
Currently deployed in dev.
For other environments (i.e. test, sandbox, prod):
make sure notifyuser has permissions to create new schemas, i.e. GRANT CREATE ON DATABASE notify TO notifyuser;
make sure NOTIFY_DATABASE_SCHEMA env var is added to db migration job
After deployment rerun readonly.sql and readwrite.sql to apply grants to new 'notify' schema in notify-db