Log accessible tables on Electric connection startup#3805
Open
KyleAMathews wants to merge 4 commits intomainfrom
Open
Log accessible tables on Electric connection startup#3805KyleAMathews wants to merge 4 commits intomainfrom
KyleAMathews wants to merge 4 commits intomainfrom
Conversation
Add an info log message during Electric startup that lists all tables accessible to the database user (tables with SELECT permission). This helps users verify their database connection is working correctly and see what tables are available for syncing. The log appears right after the "Connected to Postgres" message and before the shapes supervisor starts, showing output like: "5 tables are accessible to Electric: [\"public.items\", ...]" https://claude.ai/code/session_012BtysQooC3gKQrgpj4KbGk
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3805 +/- ##
===========================================
+ Coverage 75.75% 87.36% +11.60%
===========================================
Files 11 23 +12
Lines 693 2050 +1357
Branches 174 547 +373
===========================================
+ Hits 525 1791 +1266
- Misses 167 257 +90
- Partials 1 2 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
- Add logged_accessible_tables? flag to State struct to track if logging has already occurred - Only log accessible tables on first startup, not during reconnections - Add stack_id to error log message for better debugging context - Remove redundant inline comment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Add logging of all tables accessible to Electric when the connection manager initializes. This helps operators understand which tables the connected database user has SELECT permission on.
Changes
list_accessible_tables!/1function that queries PostgreSQL for all ordinary and partitioned tables (excluding system schemas) that the connected user has SELECT permission onlog_accessible_tables/1function that retrieves and logs the list of accessible tables during connection setup, with error handling for database connection issuesImplementation Details
has_table_privilege()to check SELECT permissions, ensuring only truly accessible tables are reportedpg_catalog,information_schema) are excluded from resultshttps://claude.ai/code/session_012BtysQooC3gKQrgpj4KbGk