You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For similar reasons to #1517, I need to acquire a single connection.
I have a large number of inbound streaming records I need to upsert, and would like to commit them at intervals so if something fails along the way (like on record 999999 of 1000000) the process doesn't need to start from scratch.
Effectively, I'm looking to do something like this:
consttransaction=newsql.Transaction(/* [pool] */)awaittransaction.begin()request=newRequest(transaction)awaitrequest.query('create the #tmp table')awaitrequest.query('COMMIT TRAN')awaitrequest.query('OPEN TRAN')awaitrequest.query('Insert some stufff into #tmp table')awaitrequest.query('Upsert stuff from #tmp table to destination table')awaitrequest.query('COMMIT TRAN')awaitrequest.query('OPEN TRAN')awaitrequest.query('Insert some more stufff into #tmp table')awaitrequest.query('Upsert more stuff from #tmp table to destination table')awaitrequest.query('COMMIT TRAN')awaitrequest.query('OPEN TRAN')awaitrequest.query('drop the #tmp table')awaitrequest.query('COMMIT TRAN')awaitrequest.query('OPEN TRAN')awaittransaction.commit()
I'm assuming hoping, the connection remains steading through all those manual commit/opens, and as long as there is an open transaction when I issue the transaction.commit(), everything should be ok.
What could go wrong with this approach ?
Thanks,
Kurt
The text was updated successfully, but these errors were encountered:
For similar reasons to #1517, I need to acquire a single connection.
I have a large number of inbound streaming records I need to upsert, and would like to commit them at intervals so if something fails along the way (like on record 999999 of 1000000) the process doesn't need to start from scratch.
Effectively, I'm looking to do something like this:
I'm
assuminghoping, the connection remains steading through all those manual commit/opens, and as long as there is an open transaction when I issue the transaction.commit(), everything should be ok.What could go wrong with this approach ?
Thanks,
Kurt
The text was updated successfully, but these errors were encountered: