-
Notifications
You must be signed in to change notification settings - Fork 65
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
Do we support Transactions? #380
Comments
hey @dgaubert - Steph is out for the next two weeks, so I am following up on this issue. Have you had a moment to review? |
@michellechandra I'd answer we don't support transactions for the moment |
I've looked into it a bit myself, and I believe the short answer is "no". Due to Carto's use of node-postgres, multiple statements given in a single call to the SQL API are processed as a single, implicit transaction, much like Beyond this implicit transaction, transactions can't really be used in a meaningful way with Carto. Note that parameterized queries, as I request in #382, would NOT be processed the same way by |
Would there be any interest in adding transaction support for batch queries? Error fallbacks are nice, but not always sufficient—sometimes it's impossible to revert changes after they've been committed. Based on my reading of the job runner and scheduler code, it seems the main difficulty is that each query in a batch is run independently. That obviously has its benefits and allows you a lot of flexibility in queuing up queries. You certainly don't want a single transaction open for days on end! However, I also see in the I.e., We could add a Would there be any interest in this? |
@ztephm commented on Fri Nov 04 2016
cc @javisantana
S/B 10399055
Context
Support client wants to know if we support Transactions
Process
I tested by pasting this into browser tab:
https://stephaniemongon.carto.com/api/v2/sql?q=BEGIN; UPDATE batch_test SET name = 3 WHERE cartodb_id = 3; SAVEPOINT my_savepoint; UPDATE batch_test SET name = 4 WHERE cartodb_id = 3; ROLLBACK TO my_savepoint; UPDATE batch_test SET name = 4 WHERE cartodb_id = 4; COMMIT;&api_key=mykey
Result
Dataset was updated properly:
but response in browser included 'total rows: 0':
I understand 'total_rows:0' refers to rows affected by last query - but if data's being overwritten instead of creating new rows then it's proper for total rows to = 0, right?
Double-checking b/c client is interested in:
The text was updated successfully, but these errors were encountered: