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

Add JSON access query support #245

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rickpr
Copy link

@rickpr rickpr commented Oct 6, 2021

When attempting to query JSON using this syntax, I receive the following error:

sqlalchemy.exc.UnsupportedCompilationError: Compiler <snowflake.sqlalchemy.base.SnowflakeCompiler object at 0x13f6cefd0> can't render element of type <function json_getitem_op at 0x1103c4790> (Background on this error at: http://sqlalche.me/e/13/l7de)

This means my workaround is to do something like this:

session.query(table1.metadata.op(':')(sqlalchemy.text('size')))

This is not only ugly but also means that I can't prototype my operations using another database like PostgreSQL before using my code live on snowflake.

This makes JSON access possible using the regular SQLAlchemy syntax.

Copy link

@u21-yizhang u21-yizhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fully support this lol

@masamitsu-murase
Copy link

masamitsu-murase commented May 5, 2022

Will this pull request be merged into the main branch?
I would like to know the future plan regarding the support of JSON.

I also developed a small library, snowflake-sqlalchemy-json, to support JSON and func.flatten(...), but I'm not sure whether creating a pull request based on this library will help this project.
If someone knows the future plan about JSON, could you share it with me?

Regards,
Murase

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.

3 participants