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

Outdated cookbook suggestion to use branched connections #908

Closed
chrisjsewell opened this issue Sep 9, 2021 · 3 comments · Fixed by #911
Closed

Outdated cookbook suggestion to use branched connections #908

chrisjsewell opened this issue Sep 9, 2021 · 3 comments · Fixed by #911

Comments

@chrisjsewell
Copy link
Contributor

Describe the bug

In https://alembic.sqlalchemy.org/en/latest/cookbook.html#sharing-a-connection-with-a-series-of-migration-commands-and-environments,
it gives a recipe using a branched connection.
However, as per Connection._branch:

deprecated:: 1.4 the "branching" concept will be removed in SQLAlchemy 2.0 as well as the "Connection.connect()" method which is the only consumer for this.

Expected behavior

The section would provide a "v2 compliant" solution

Thanks!

@chrisjsewell chrisjsewell added the requires triage New issue that requires categorization label Sep 9, 2021
@zzzeek
Copy link
Member

zzzeek commented Sep 9, 2021

agree, the general idea is to just lose the "with connectable.connect()" part, it was trying to guess if the given "connection" were an Engine or Connection. no more guessing, it's a Connection. can accept a PR for this.

@zzzeek zzzeek added documentation and removed requires triage New issue that requires categorization labels Sep 9, 2021
@chrisjsewell
Copy link
Contributor Author

chrisjsewell commented Sep 9, 2021

Thanks for the rapid response!
So to clarify, you feel there should be no side effects to just running with no context manager? (i.e. connection = connectable)

(p.s. just spent the last few hours watching your v2 YouTube tutorial; super helpful 🙏)

@zzzeek
Copy link
Member

zzzeek commented Sep 9, 2021

yup something like that, because the recipe has "with connctoin.begin()" on the outside of the alembic command as it is, you're already inside a transactional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants