Skip to content
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

Reuse the sqlalchemy engine once it's created #4493

Merged
merged 11 commits into from
Dec 10, 2024
Merged

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Dec 6, 2024

No description provided.

Requires setting `async_db_url` to the same database as `db_url`, except using
an async driver; this will vary by database.
Lendemor
Lendemor previously approved these changes Dec 6, 2024
Move connect engine kwargs to a separate function
@masenf
Copy link
Collaborator Author

masenf commented Dec 6, 2024

latest commit unifies the connection args and adds pool_pre_ping to avoid getting dead connections from the pool (now that we're not creating a new pool every time)

reflex/config.py Outdated
@@ -568,6 +571,10 @@ class EnvironmentVariables:
environment = EnvironmentVariables()


# These vars are not logged because they may contain sensitive information.
_sensitive_env_vars = {"DB_URL", "ASYNC_DB_URL"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should add redis url here as well?

@masenf masenf merged commit 4922f7b into main Dec 10, 2024
33 checks passed
@masenf masenf deleted the masenf/db-reuse-engine branch December 10, 2024 20:37
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.

3 participants