-
Notifications
You must be signed in to change notification settings - Fork 100
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
[Go][Format] initial attempt at wrapping adbc for database/sql #97
Conversation
See arrow-adbc/c/validation/adbc_validation.c Lines 268 to 279 in 1ca2d2d
Disabling autocommit begins a transaction; commit/rollback also begin a transaction; enabling autocommit also runs a commit. |
Gotcha, so the interfaces should allow setting options on an existing connection, not only setting options before initializing it. I'll make the adjustment. |
@lidavidm Do we have any constants for setting the Isolation level of the transactions yet? If not, the golang values are:
With the documentation that if a driver does not support a given isolation level, an error may be returned. This is in addition to a |
We don't, it probably makes sense to define them |
@lidavidm Added them to this PR, let me know if you have any comments / issues with them. Thanks! |
adbc.h
Outdated
/// \brief The name of the canonical option for whether the current | ||
/// transaction should be restricted to being a read-only transaction. | ||
#define ADBC_CONNECTION_OPTION_TRANSACTION_READ_ONLY \ | ||
"adbc.connection.transaction.readonly" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, so Golang has you explicitly manage transactions. DBAPI/JDBC/ODBC have "auto commit on" and you implicitly manage transactions (by disabling autocommit, then calling commit/rollback). In these APIs, readonly is a property of the connection, not the transaction. Given that the rest of the APIs are patterned after DBAPI/JDBC/ODBC, I think this would make more sense as a connection property as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, okay. I'll change the option to be adbc.connection.readonly
instead of adbc.connection.transaction.readonly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, let me know if there's anything else you'd like me to modify.
Here's my first shot at creating the wrapper. After this I'll look into actually creating an implementation to write tests with.
However, I did come across one thing: There are
Commit
andRollback
methods for a connection, but there's nothing to actually begin a transaction. Nor anything specific for defining transaction options such as Isolation level or Read-Only etc.For Go's
sql
package there needs to be aBeginTx
method on a connection which also shouldn't require creating a new connection (ie: start a new connection with autocommit turned off?) So i'm not sure of the best way to implement this in the current framework we have.