tsload flag reference

You can modify the behavior of tsload with flags.

For recurring data loads and for scripting loads, use tsload (the ThoughtSpot Loader). This reference section lists all the flags that can be used to modify the behavior of tsload.

General tsload flags

--target_database <database>

Specifies the pre-existing target database into which tsload should load the data.

--target_schema <schema>

Specifies the target schema. Default is falcon_default_schema.

--target_table <table>

Specifies the tables that you want to load into the database.

The tables must exist in the database specified by --target_database.

--empty_target

Specifies that any data in the target table is to be removed before the new data is loaded.

If supplied, any rows that exist in the table specified by --target_database and --target table will be deleted before this data load.

To perform an “upsert” on the existing data, omit this flag or specify --noempty_target.

--max_ignored_rows <number>

Specifies the maximum number of rows that can be ignored if they fail to load.

If the number of ignored rows exceeds this limit, the load will be aborted.

--bad_records_file <path_to_file>/<file_name>

Specifies the file to use for storing rows that failed to load.

Input rows that do not conform to the defined schema in ThoughtSpot will be ignored and inserted into this file.

--date_format <date_formatmask>

Specifies the format string for date values. The default format is yearmonthday.

For example Dec 30th, 2001 is represented as 20011230. Use the date format specifications supported in the strptime library function.

--date_time_format <date_formatmask> <time_formatmask>

Specifies the format string for datetime values. The default is yearmonthday hour:minute:second.

For example Dec 30th, 2001 1:15:12 is represented as 20011230 01:15:12. Use the datetime format specifications supported in the strptime library function.

--time_format <time_formatmask>

Specifies the format string for time values.

The default is hour:minute:second. Use the time format specifications supported in the strptime library function.

--v=[0|1|2|3

Specifies the verbosity of log messages.

Provide a value for verbosity level. By default, verbosity is set to the minimum, which is 0. This value is similar to a volume control. At higher levels your log receives more messages and that log more frequently.

This is used for debugging. You should not change this value unless instructed by ThoughtSpot Support.

--skip_second_fraction

Skips fractional seconds when loading data.

If supplied, the upserts logic may be affected, especially if the date time being loaded is a primary key, and the data has millisecond granularity. Load the data twice, first time as a string with a primary key, and again with second granularity date time. There is no support to store fractional seconds in the ThoughtSpot system.

File loading tsload flags

The following flags are used when loading data from an input file:

--source_file <path_to_file>/<file_name>

Specifies the location of the file to be loaded.

--source_data_format [csv|delimited|parquet]

Specifies the data file format.

This is optional. The default is csv.

--field_separator "<delimiter>"

Specifies the field delimiter used in the input file.

--flexible [true | false]

Specifies whether the input data file exactly matches the target schema. When true, discards extra columns in the input file and fills missing columns in the input file with nulls. When false, the load only proceeds if the input data file exactly matches the target schema. The columns in the input file can also from the column order in the target schema.

The default is false.

--trailing_field_separator

Specifies that the field separator appears after every field, including the last field per row.

Example row with trailing field separator: a,b,c,. The default is false.

--null_value "<null_representation>"

Specifies how null values are represented in the input file.

These values will be converted to NULL upon loading.

--date_converted_to_epoch [true|false]

Specifies whether the “date” or “datetime” values in the input file are represented as epoch values.

--boolean_representation [true_false | 1_0 | T_F | Y_N]

Specifies the format in which boolean values are represented in the input file.

The default is T_F. You can also use this flag to specify other values. For example, if your data used Y for true and NULL for false, you could specify `--boolean_representation Y_NULL.

--has_header_row

Indicates that the input file contains a header row.

If supplied, column names in the header row are used to match column names in the target table in ThoughtSpot. If not supplied, the first row of the file is loaded as data, the same as all subsequent rows.

--escape_character "<character>"

Specifies the escape character used in the input file.

If no value is specified, the default is "`(double quotes).

--enclosing_character "<character>"

Specifies the enclosing character used in the input file.

If the enclosing character is double quotes, you need to escape it, as in this example: --enclosing_character "\""

--use_bit_boolean_values = [true | false]

Specifies how boolean values are represented in the input file.

If supplied, the input CSV file uses a bit for boolean values, so the false value is represented as 0x0 and true as 0x1. If omitted or set to false, boolean values are assumed to be T_F, unless you specify something else using the flag --boolean_representation [true_false | 1_0 | T_F | Y_N].

--format_file

Specifies the filepath that describes the formats for the columns you are importing. The format file must be in JSON format, similar to the following example:

{
"database": "test",
"schema": "falcon_default_schema",
"table": "format_file_example",
"columns": [{
"name": "sale_date",
"date_format": "%d/%m/%Y"
}, {
"name": "warranty_date",
"date_format": "%d %b %Y"
}, {
"name": "POS Timestamp",
"date_format": "%d/%m/%Y",
"datetime_format": "%d/%m/%Y %H:%M:%S"

  }, {
    "name": "Inventory Timestamp",
    "date_format": "%d/%m/%Y",
    "datetime_format": "%d/%m/%Y %H:%M:%S"

  }]
}