stor insert

For database.

Insert information into a specified table in the in-memory sqlite database.

Command Type

built-in

Signature

> stor insert {flags}

Flags

  • --table-name, -t {string}: Name of the table you want to insert into.
  • --data-record, -d {record}: A record of column names and column values to insert into the specified table.

Input/output types:

input output
nothing table
record table
table table
any table

Examples

Insert data in the in-memory sqlite database using a data-record of column-name and column-value pairs

> stor insert --table-name nudb --data-record {bool1: true, int1: 5, float1: 1.1, str1: fdncred, datetime1: 2023-04-17}

Insert data through pipeline input as a record of column-name and column-value pairs

> {bool1: true, int1: 5, float1: 1.1, str1: fdncred, datetime1: 2023-04-17} | stor insert --table-name nudb

Insert data through pipeline input as a table literal

> [[bool1 int1 float1]; [true 5 1.1], [false 8 3.14]] | stor insert --table-name nudb

Insert ls entries

> ls | stor insert --table-name files

Insert nu records as json data

> ls -l | each {{file: $in.name, metadata: ($in | reject name)}} | stor insert --table-name files_with_md

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.