7. Import#

7.1. Synopsis#

IMPORT INTO <table_name> FILES (
 format={CSV|TSV|<custom_format_definition>},
 uris=<uris>
);

7.2. Description#

IMPORT will import files into specified table in QuasarDB. You can specify format as CSV, TSV or custom data type. If file contains header it must match table schema (order and naming of columns).

7.3. Parameters#

table_name

The name of existing table to which data from files will be imported.

custom_format_definition

In case file which you want to import is not CSV or TSV format you can define custom format properties. You will need to provide bellow parameters.

delimiter - delimiter symbol, accepts char.

quote_character - specifies char in which strings are quoted, accepts char.

first_row_is_header - specifies if header is included in file, accepts bool.

trim_characters - specifies characters which will be removed from each line.

uris

List file paths which function will attempt to import.

7.4. Examples#

7.4.1. Importing CSV#

$timestamp,i,d,s
2024-01-23T16:00:00.016759000,12,12.34,mkopoi
2024-01-23T16:00:00.016759000,23,23.45,snjksa
IMPORT INTO test FILES (format=CSV, uris=['import.csv']);

7.4.2. Importing TSV#

$timestamp  i d s
2024-01-23T16:00:00.016759000 12  12.34 mkopoi
2024-01-23T16:00:00.016759000 23  23.45  snjksa
IMPORT INTO test FILES (format=TSV, uris=['import.tsv']);

7.4.3. Importing custom file format#

$timestamp;i;d;s
2024-01-23T16:00:00.016759000;12;12.34;mkopoi
2024-01-23T16:00:00.016759000;23;23.45;snjksa
IMPORT INTO test FILES (format=[delimiter=';', quote_character='"', first_row_is_header=true, trim_characters=[' ', '\t']], uris=['import.txt']);