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
Is there an any support for AS OF SYSTEM TIME in either the transaction variant:
BEGINAS OF SYSTEM TIME'2019-04-09 18:02:52.0+00:00';
or the query variant:
SELECT*FROM t, u, v AS OF SYSTEM TIME'-4h';
?
It seems to me that there is currently no way to use this cockroach feature from within django. The code emitting BEGIN statements seems to be berried 3 dependencies down the line within psycopg.BaseConnection._get_tx_start_command, so I am not sure how to approach this elegantly.
The API could like like this for transactions (extended django.db.transaction.Atomic/.atomic):
The following works, but completely sidesteps django's transaction management. So I am sure it will lead to hard to debug issues down the road in more complex apps.
fromdjango.dbimportconnectionclassAsOfTransaction:
def__init__(self, as_of_system_time):
self.as_of_system_time=as_of_system_timedef__enter__(self):
connection.cursor().execute("BEGIN AS OF SYSTEM TIME %s", (self.as_of_system_time,))
def__exit__(self, exc_type, exc_value, traceback):
ifexc_typeisnotNone:
connection.cursor().execute("ROLLBACK")
else:
connection.cursor().execute("COMMIT")
Is there an any support for
AS OF SYSTEM TIME
in either the transaction variant:or the query variant:
?
It seems to me that there is currently no way to use this cockroach feature from within django. The code emitting
BEGIN
statements seems to be berried 3 dependencies down the line withinpsycopg.BaseConnection._get_tx_start_command
, so I am not sure how to approach this elegantly.The API could like like this for transactions (extended
django.db.transaction.Atomic
/.atomic
):or like this for queries (modified
QuerySet
class):Are there any plans to add this?
The text was updated successfully, but these errors were encountered: