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

SNOW-1510090: Adding support for passing nil to variant columns #1170

Open
sahilsalim99 opened this issue Jun 27, 2024 · 2 comments
Open

SNOW-1510090: Adding support for passing nil to variant columns #1170

sahilsalim99 opened this issue Jun 27, 2024 · 2 comments
Assignees
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team

Comments

@sahilsalim99
Copy link

What is the current behavior?

My code
_, err = db.ExecContext(ctx, "INSERT INTO test_variant SELECT ?", nil)

The above results in

Error inserting into Snowflake: 002023 (22000): SQL compilation error:
Expression type does not match column data type, expecting VARIANT but got VARCHAR(16777216) for column VAR_COL

What is the desired behavior?

Being able to pass nil to variant columns while binding

How would this improve gosnowflake?

It would make it easier to work with variant columns.

The current workaround we're making use of involves wrapping it with a TRY_PARSE_JSON/PARSE_JSON :
_, err = db.ExecContext(ctx, "INSERT INTO test_variant SELECT TRY_PARSE_JSON(?)", nil)

@github-actions github-actions bot changed the title Adding support for passing nil to variant columns SNOW-1510090: Adding support for passing nil to variant columns Jun 27, 2024
@sfc-gh-dszmolka
Copy link
Contributor

hi there - as an alternative, would it be possible to try something like this #831 (comment) ?

@sfc-gh-dszmolka sfc-gh-dszmolka self-assigned this Jun 28, 2024
@sfc-gh-dszmolka sfc-gh-dszmolka added question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team labels Jun 28, 2024
@sahilsalim99
Copy link
Author

For our use case we do not have info on the data type of the columns we're trying to insert into. Hence it would be great if passing nil to a variant column would work as it does for other data types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue is a usage/other question rather than a bug status-triage_done Initial triage done, will be further handled by the driver team
Projects
None yet
Development

No branches or pull requests

2 participants