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

[discuss] Transaction API's autocommit #1253

Open
kevinjqliu opened this issue Oct 27, 2024 · 1 comment
Open

[discuss] Transaction API's autocommit #1253

kevinjqliu opened this issue Oct 27, 2024 · 1 comment

Comments

@kevinjqliu
Copy link
Contributor

kevinjqliu commented Oct 27, 2024

Porting over from #1246

Can be a potential footgun (#1246 (comment))
Autocommit usage (#1246 (comment))

However, there may still be some concerns around this since Transaction is a public class. If this is the case, I think we can start from making the parameter "private" (autocommit -> _autocommit) and/or adding some doc to explain the usage.

@kevinjqliu
Copy link
Contributor Author

The idea is to make the code simpler if we only want to evolve schema/spec/...
i.e.

with table.update_schema() as update:
    update.add_column("some_field", IntegerType(), "doc")

instead of another with..transaction wrapper

with table.transaction() as transaction:
    with transaction.update_schema() as update_schema:
        update.add_column("some_other_field", IntegerType(), "doc")

....

What about moving the autocommit logic out of Transaction and into the class that uses it instead?

For example, UpdateSchema can implement __enter__ and __exit__ to commit the transaction automatically?

Currently, these classes use autocommit=True:

  • ManageSnapshots
  • UpdateSchema
  • UpdateSpec

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

No branches or pull requests

1 participant