Skip to main content Link Menu Expand (external link) Document Search Copy Copied

CSV datafile reference

This reference page provides information on how to structure a CSV file with data ready to be imported to FeatureBase Community.

Table of contents

Before you begin

Syntax

{source_column_name}[__data-type[_constraint-value...]],...
{record,...}

Arguments

Argument Description Required
source_column_name Source column name to translate to FeatureBase index Yes
data-type Target data type. Can be omitted if defined with ingest tool --header flag.
constraint_value Data type constraint for FeatureBase data types. Can be omitted if defined with ingest tool --header flag
record record data to be translated to FeatureBase Yes

Additional information

Header column names, data-types and constraints have special meaning and must be explicitly defined:

  • in the CSV file, or
  • using CSV ingest flags defined at the command line.
  • Use double quotes "..." to enclose fields containing:
    • Line breaks (CRLF)
    • Commas
    • double quotes

Examples

header-defined.csv

This CSV file defines the header row as follows:

Field Data type Additional
username String This will be used as the primary key
salary Int  
created_at Timestamp Timestamp field with 1 second granularity and parse dates with this layout 2006-01-02T15:04
balance Decimal Scale of 2 (store two decimal places)
account_types StringArray Values are comma separated list enclosed in double quotes
username__String,salary__Int,created_at__Timestamp_s_2006-01-02T15:04,balance__Decimal_2,account_types__StringArray
erin,85000,2019-05-22T13:44,334.43,"checking,savings"
will,90000,2019-05-22T13:44,111.13,"savings"
john,35000,2019-05-22T13:44,999.22,"savings"
paul,50000,2019-05-22T13:44,444.53,"checking,savings"
mary,40000,2019-05-22T13:44,555.63,"checking,savings"
jack,95000,2019-05-22T13:44,888.73,"savings"
dogg,85000,2019-05-22T13:44,777.83,"checking,savings"
zoom,15000,2019-05-22T13:44,222.93,"checking"

header-undefined.csv

Header data types need to be defined by the ingest tool.

asset_tag,fan_time,fan_val
ABCD,2019-01-30,40%
BEDF,2019-01-08,10%
BEDF,2019-01-08,20%
ABCD,2019-01-04,30%

Next step

Refer to the CSV ingest tool reference for instructions on importing the CSV file to FeatureBase Community.