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

Accept JSON type #70

Closed
1 task done
rcourivaud opened this issue Mar 1, 2022 · 4 comments · Fixed by #74
Closed
1 task done

Accept JSON type #70

rcourivaud opened this issue Mar 1, 2022 · 4 comments · Fixed by #74
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@rcourivaud
Copy link

Checklist

  • There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

I want to be able to show JSON column in detail page.

Could not find field converter for column questions (<class 'sqlalchemy.dialects.postgresql.json.JSON'>).

Describe the solution you would like.

No response

Describe alternatives you considered

No response

Additional context

No response

@aminalaee aminalaee added enhancement New feature or request good first issue Good for newcomers labels Mar 1, 2022
@aminalaee
Copy link
Owner

Hey @rcourivaud ,

Thank you for reporting this. I think this needs two steps:

Feel free to do any PRs for these.

@lovetoburnswhen
Copy link
Contributor

What if we used sqlalchemy-utlis to automatically serialize the data based on the engine's dialect? https://sqlalchemy-utils.readthedocs.io/en/latest/data_types.html#module-sqlalchemy_utils.types.json

This could also be used for array types https://sqlalchemy-utils.readthedocs.io/en/latest/data_types.html#module-sqlalchemy_utils.types.scalar_list

@aminalaee
Copy link
Owner

Yeah at some point we should consider sqlalchemy-utils and geo-alchemy and other libraries. It's the same process as supporting SQLModel, basically needs to define WTForm converters for those fields.
But we need the sqlalchemy.dialects.postgresql.json.JSON support anyway as it can be used without the sqlalchemy-utils library.

So I think for this issue we can focus on JSON type in PostgreSQL dialect and in another issue track sqlalchemy-utils. What do you think?

@aminalaee
Copy link
Owner

So looks like the JSON column in SQLAlchemy would cover all JSON compatible columns in databases supporting JSON like PostgreSQL and the ones not supporting like SQLite.
This should be good for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants