Skip to content

fix: Fix "Connection is closed" error when using browser authentication #257

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 1 commit into from
Sep 16, 2024

Conversation

dlouseiro
Copy link
Contributor

@dlouseiro dlouseiro commented Sep 16, 2024

The purpose of this PR is to solve the issue reported here.

Root cause:

There was one usage of engine.connect outside of a context manager (in create_engine), causing the connector to leave one connection "lying around".

I did not dive too deep into the internals of the connector nor focused too much in understanding why is it different for the browser authentication mechanism, but mostly in ensuring all calls to engine.connect() were done within a context manager, ensuring SQL alchemy does its job in closing all connections when they should be closed.

Implementation details:

  • Use a context manager when checking if the database exists (in the create_engine ) method.

@dlouseiro dlouseiro changed the title Fix "Connection is closed" error when using browser authentication fix: Fix "Connection is closed" error when using browser authentication Sep 16, 2024
@edgarrmondragon edgarrmondragon self-requested a review September 16, 2024 15:02
@edgarrmondragon
Copy link
Member

Thanks @dlouseiro!

@edgarrmondragon edgarrmondragon merged commit c6c6305 into MeltanoLabs:main Sep 16, 2024
2 of 10 checks passed
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