I have temporary data stored in a variable, which is also displayed in a table component.
I want to store this data in a Retool managed database. I have managed to insert the individual records by calling a query on every item of the data:
INSERT INTO spec_table (
name,
instrument,
minimum,
maximum,
is_reference,
unit,
text_value,
is_numeric
)
VALUES
(
{{spec.name}},
{{spec.instrument}},
{{spec.minimum}},
{{spec.maximum}},
{{spec.is_reference}},
{{spec.unit}},
{{spec.text_value}},
{{spec.is_numeric}}
)
RETURNING spec_id
But it would make much more sense to manage this in one query, which I tried like this:
INSERT INTO
spec_table ("name", instrument, minimum, maximum, is_reference, unit, text_value, is_numeric)
SELECT
"name",
instrument,
minimum,
maximum,
is_reference,
unit,
text_value,
is_numeric
FROM {{selectedSpecifications.value}};
This generates an error: syntax error at or near "$1"
Do I need to map this array somehow to use it?