feat: Remove long standing connections on sql state and catalog backends#676
Conversation
📝 WalkthroughWalkthroughThe changes refactor backend classes to accept a Changes
Sequence Diagram(s)sequenceDiagram
participant CacheBase
participant SqlCatalogBackend
participant SqlStateBackend
participant SqlConfig
participant Engine
CacheBase->>SqlCatalogBackend: __init__(sql_config=self, table_prefix)
CacheBase->>SqlStateBackend: __init__(sql_config=self, table_prefix)
SqlCatalogBackend->>SqlConfig: get_sql_engine()
SqlConfig->>Engine: (returns Engine)
SqlStateBackend->>SqlConfig: get_sql_engine()
SqlConfig->>Engine: (returns Engine)
Would you like to see a more detailed breakdown of how the Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🧰 Additional context used🧬 Code Graph Analysis (1)airbyte/caches/_state_backend.py (4)
⏰ Context from checks skipped due to timeout of 90000ms (2)
🔇 Additional comments (12)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
CodeRabbit (@coderabbitai) review |
…n_sql_state_and_catalog_backends
da64cb2 to
96a76eb
Compare
|
/test-pr
|
Aaron ("AJ") Steers (aaronsteers)
left a comment
There was a problem hiding this comment.
Approving - after careful review, and running tests manually with our creds.
Thanks again Ben Wilen (@benjaminwilen) for this contribution. Will merge today and release shortly. 🙏
6cb8e07
into
airbytehq:main
What does this PR do?
This PR modifies how
SqlCatalogBackendandSqlStateBackendconnect to an sql engine to do so lazily and per query execution instead of eagerly and in a single connection. This allows long running syncs to complete without receiving the following error:Testing
Additional Notes
Pros of this PR
client_session_keep_alive=True, instead opts to open a connection for each individual query execution.SnowflakeSqlProcessorby acceptingsql_configas a param.Cons of this PR
SqlCatalogBackendandSqlStateBackendare not backwards compatible if a user uses this classes outside of the one internal reference for each within PyAirbyte code.Summary by CodeRabbit