3

I am making a select call on a table and it always returns 1 row. I would like to get the data in json format.

{
  "column_name1": "value1",
  "column_name2": "value2",
}

Does snowflake query allows anything like this ?

1 Answer 1

11

object_construct is the way to go for this.

For example,

select object_construct(*) from t1;
Sign up to request clarification or add additional context in comments.

2 Comments

The only problem is that it doesn't return the columns whose values are null, which is a issue in my use case
for people from the future, there is also OBJECT_CONSTRUCT_KEEP_NULL(*)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.