ydb-platform / ydb-platform/ydb-sqlalchemy
Add JsonDocument type support
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40
- Forks
- 13
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 3
Description
Problem
Currently ydb-sqlalchemy does not support the JsonDocument type. When writing a column of type JsonDocument, the parameter is always cast to Json, resulting in the error:
Failed to convert 'meta_info': Json to Optional<JsonDocument>
The issue is in compiler/base.py where the type is always mapped to Json.
Workaround
sqla.text(f"CAST(:{param_name} AS JsonDocument)").bindparams(bindvalue)
Expected behavior
JsonDocument should be a first-class supported type in ydb-sqlalchemy, both for reading and writing.
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.
Research direction
Start in compiler/base.py, where JsonDocument is currently mapped to Json, and inspect the existing type handling for reading and writing. Compare the current behavior with the CAST(:param AS JsonDocument) workaround, then verify that JsonDocument parameters and returned columns work without that workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlalchemy
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100