Issues with DateTime ISO fields
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 45/100
Research direction
Start by inspecting gql/renderer_dataclasses.py around lines 153-160, especially how suffix is handled for nullable DateTime fields and when DATETIME_FIELD is selected. Reproduce the gql_run query with a DateTime result and verify that the generated dataclass can deserialize the returned ISO value without the reported TypeError.
Written by the indexing model from the issue text.
Description
when i run gql_run and the renderer_dataclasses.py encounters a DateTime field it generates a field:
var_name: datetime = None
when I run a query that returns a datetime object I get the following error:
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 220, in _decode_generic
res = _get_type_cons(type_)(xs)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 260, in <genexpr>
for x in xs)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 165, in _decode_dataclass
infer_missing)
File "/Users/jasper/Documents/test/test-graph-python-client/env/lib/python3.7/site-packages/dataclasses_json/core.py", line 179, in _decode_dataclass
dt = datetime.fromtimestamp(field_value, tz=tz)
TypeError: an integer is required (got type str)
I think this is because in:
https://github.com/graphql-python/gql-next/blob/5c81e58862c8df3a335b81bb2f77a0fab2c50570/gql/renderer_dataclasses.py#L153-L160
suffix is being overwritten if the field is nullable and DATETIME_FIELD isn't being used.
- Dominant language
- Python
- Stars
- 78
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from graphql-python/gql-next
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
graphql-python/gql-next#30 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
graphql-python/gql-next#28 ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
graphql-python/gql-next#27 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
graphql-python/gql-next#25 · 3 comments · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
graphql-python/gql-next#22 · 1 comment ·
All issues in graphql-python/gql-next
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
anthropics/skills#1811 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
speaches-ai/speaches#678 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
datalayer/mcp-compose#42 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
UKGovernmentBEIS/inspect_evals#2523 ·