Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add JSON type #317

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

akkuman
Copy link

@akkuman akkuman commented Jul 2, 2024

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Ensure PR doesn't contain untouched code reformatting: spaces, etc.
  • Run flake8 and fix issues.
  • Run pytest no tests failed. See https://clickhouse-sqlalchemy.readthedocs.io/en/latest/development.html.

@akkuman akkuman changed the title Feat json type feat: Add JSON type Jul 2, 2024
@franz101
Copy link

franz101 commented Jul 2, 2024

How do you access a key value?
text(column['a'])?

@akkuman
Copy link
Author

akkuman commented Jul 3, 2024

How do you access a key value? text(column['a'])?

This is due to clickhouse restrictions so it cannot be accessed.
clickhouse queries for json type fields actually return tuples of values

If you want to access, you can only use toJSONString to convert to a string, then deserialize json to access, or use https://clickhouse.com/docs/en/sql-reference/functions/json-functions directly

@akkuman
Copy link
Author

akkuman commented Jul 3, 2024

How do you access a key value? text(column['a'])?

maybe you can use https://clickhouse.com/docs/en/sql-reference/data-types/object-data-type#displaying-json-columns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does support json field ORM?
2 participants