|Using TenUp ||
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.
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
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 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.
$ tenup64 -u [USERNAME] -p [PASSWORD] @[TABLE_TREE_FILE] [FILE_NAME]
$ tenup64 -u login -p password -g https://www2.1010data.com/beta-latest/gw @C:\tenupexample\Retail.xml C:\tenupexample\data.csv
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: