1

I'm trying to figure out how to run an INSERT (i guess update?) query to insert into rows which are nested, but latter rows also have a nested schema in themselves.

For instance i have something like enter image description here

What would a general template query look like?

I know that for the lines it would look something like enter image description here

2
  • Please try to ask a more specific question, you'll get a more specific answer. Initial state, end results expected? Commented Oct 1, 2018 at 9:46
  • Updated with an example schema and what i've gotten so far. Commented Oct 1, 2018 at 11:12

1 Answer 1

1

Managed to solve it with:

UPDATE test 
SET lines=ARRAY(
SELECT line FROM UNNEST(lines) AS line
UNION ALL
SELECT (
'::someValue::,
ARRAY<STRUCT<STRING,STRING,FLOAT64>>[('someId','someString',1.0)]
)
WHERE id='someId'
Sign up to request clarification or add additional context in comments.

Comments

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.