TenUp: Step-by-step example

The following is a step-by-step example of uploading a csv file to the 1010data Insights Platform, including creating a table tree file for uploading metadata.

Prepare the data file

You will need a clean data file to upload to the 1010data Insights Platform. The data types must match the data types supplied in the table tree metadata, with the columns in the same order. The flat file to upload is typically a csv (comma-separated values) file.

In this example, the data to upload is contained in a file named data.csv. The following is the contents of data.csv:

531,1,5,1
532,1,1.6,2
534,1,8.25,3
535,2,3.85,3
536,2,6.02,4
537,3,10.35,6
538,1,6.95,8
539,2,5,1
540,2,1.44,2
541,3,10,7
543,1,11,9

Provide metadata

To upload the data file to a 1010data Insights Platform table, you need to supply TenUp with metadata for your table. Metadata can be supplied in a table tree, spec tree, and/or on the TenUp command line. In this simple example, the metadata is supplied with a single source--a table tree saved in a file named Retail.xml.

The following is the contents of Retail.xml:

<table name="example.retail">
  <title>Retail</title>
  <sdesc>Test table</sdesc>
  <cols>
    <th name="transid" type="i">Transaction ID</th>
    <th name="store" type="i">Store</th>
    <th name="sumsales" type="f" format="type:currency">Sum of&#10;Sales</th>
    <th name="totunits" type="f" format="type:num;width:4;dec:0">Total Units</th>
  </cols>
</table>

This table tree provides the following information for the 1010data Insights Platform table: the table name and title, a short description, and the names and titles of the table's four columns. The transid and store columns contain integers. The sumsales and totunits columns contain floats. Note that sumsales and totunits have a display format in addition to a data type.

For more detailed information about table tree tags, refer to Table Tree in the XML API Reference Manual.

For a detailed explanation of data types and display formats, see Data types and display formats in the 1010data Reference Manual.

Issue the TenUp command

As discussed in Loading data from a flat file, the template for loading a flat file into TenUp is as follows:
$ tenup64 -u [USERNAME] -p [PASSWORD] @[TABLE_TREE_FILE] [FILE_NAME]
If you use the Retail.xml table tree and the data.csv flat file, you would enter a command similar to the following:
$ tenup64 -u login -p password -g https://www2.1010data.com/beta-latest/gw 
      @C:\tenupexample\Retail.xml C:\tenupexample\data.csv
Note: For the sake of completeness, the above TenUp command also contains a gateway, specified by the -g switch. If you are using the default gateway, you can omit -g and the gateway information.
login
Your 1010data Insights Platform user ID.
password
Your 1010data Insights Platform password.
https://www2.1010data.com/beta-latest/gw
Your specified gateway (can be omitted if the default gateway).
@C:\tenupexample\Retail.xml
The complete path to the table tree Retail.xml, containing the table metadata. The @ specifies that the information that follows is the path to the table tree file.
C:\tenupexample\data.csv
The complete path to the table data to upload, saved as a csv file.

Confirm the table upload

You can log in to the 1010data Insights Platform and view the uploaded table. The table can be found in the example folder with the name retail and a title of Retail. The table will appear as follows: