Datasets into the database: a dataset as INSERT statements, its tables and rows in an order the database accepts and its values in the form the driver needs.
Datasets into the database: a dataset as INSERT statements, its tables and rows in an order the database accepts and its values in the form the driver needs.
(inserts registry dataset {:keys [on-conflict]})[{:insert-into ... :values [row ...]} ...] for a dataset: its tables, parents before the tables referencing them and, within a table, rows before the rows referencing them (rows referencing each other in a cycle are fine in one INSERT: the database checks foreign keys at the end of the statement); enum, json and array values in the form the driver needs. Generated columns are left out; a table with an identity column gets OVERRIDING SYSTEM VALUE, so the ids the rows carry (and the references to them) hold; a column a row lacks is DEFAULT. A table the registry does not have, or a column the table does not have, is an error thrown by the call (the vector is built eagerly). Option :on-conflict :nothing adds ON CONFLICT DO NOTHING.
[{:insert-into ... :values [row ...]} ...] for a dataset: its tables, parents before the
tables referencing them and, within a table, rows before the rows referencing them (rows
referencing each other in a cycle are fine in one INSERT: the database checks foreign keys
at the end of the statement); enum, json and array values in the form the driver needs.
Generated columns are left out; a table with an identity column gets OVERRIDING SYSTEM
VALUE, so the ids the rows carry (and the references to them) hold; a column a row lacks is
DEFAULT. A table the registry does not have, or a column the table does not have, is an
error thrown by the call (the vector is built eagerly). Option :on-conflict :nothing adds
ON CONFLICT DO NOTHING.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |