crate / crate/cratedb-django

Support `TimeField`

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Python
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

CrateDB does not support storage for timetz, all times have to be stored either in a `timestamp` or `timestamptz`.

`TimeField` only takes the time part of a timestamp, CrateDB trips if we try to do:

```python
TimeField(datetime.datetime.now().time().isoformat())
# SQLParseException[Cannot cast value `22:43:10.001021` to type `timestamp without time zone`]
```
Because CrateDB needs the full timestmap.

But if we pass a timestamp, the validator of the field trips with:
`django.core.exceptions.ValidationError: ['“2020-01-01T22:43:10.001021” value has an invalid format. It must be in HH:MM[:ss[.uuuuuu]] format.']`

To fix this we should modify the validator of `cratedb.fields.TimeField`

Contributor guide

Open the contributing guide

Research direction

The affected entry point is cratedb.fields.TimeField; start by reading its validator and reproducing the two inputs shown against CrateDB. Done means a timestamp containing a date and time can be accepted for storage while TimeField continues to represent the time portion.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python, sql
Domain
backend, databases
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.