cockroachdb / cockroachdb/django-cockroachdb
using AS OF SYSTEM TIME
- Dominant language
- Python
- Stars
- 174
- Forks
- 31
- PR merge metrics
- No merged PRs in 30d
Description
Is there an any support for [`AS OF SYSTEM TIME`](https://www.cockroachlabs.com/docs/stable/as-of-system-time.html) in either the transaction variant:
```sql
BEGIN AS OF SYSTEM TIME '2019-04-09 18:02:52.0+00:00';
```
or the query variant:
```sql
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`](https://github.com/psycopg/psycopg/blob/master/psycopg/psycopg/connection.py#L497-L515), so I am not sure how to approach this elegantly.
The API could like like this for transactions (extended `django.db.transaction.Atomic`/`.atomic`):
```python
from django_cockroachdb.transaction import atomic
with atomic(as_of_system_time="-4h"):
pass
```
or like this for queries (modified `QuerySet` class):
```python
Poll.objects.all().as_of_system_time("-4h")
```
Are there any plans to add this?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.