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

Support a Callable for a sync connection pool. #37

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

tjni
Copy link
Owner

@tjni tjni commented Dec 17, 2024

This seems to enable using the SQLAlchemy connection pool using the following pattern:

  def get_pymysql_sqlalchemy_pool(uri: str) -> Callable[[], pymysql.Connection]:
      pool = create_pool_from_url(uri)
      return lambda: cast(pymysql.Connection, closing(pool.connect()))

This seems to enable using the SQLAlchemy connection pool using the
following pattern:

  def get_pymysql_sqlalchemy_pool(uri: str) -> Callable[[], pymysql.Connection]:
      pool = create_pool_from_url(uri)
      return lambda: cast(pymysql.Connection, closing(pool.connect()))
@tjni tjni merged commit e5d6275 into main Dec 17, 2024
6 checks passed
@tjni tjni deleted the callable-sync-connection-pool branch December 17, 2024 06:20
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.

1 participant