Skip to main content

Import data

Take a local CSV file and write the data to a table.


studio import-data <table> <file>

ArgumentTypeDefaultDescription
<table>string--The Studio-defined table name.
<file>string--Path to the CSV file.

You must also include the project ID the table is a part of.

OptionTypeDefaultDescription
--pidstring--The unique project ID.
--chainstring--The chain name to write data to.
--providerUrlstring--The provider RPC URL for the chain.
--privateKeystring--The account's private key that's writing data.

Example

studio import-data users ./data.csv --pid eac4b0f2-ab4d-41ec-9789-19f0a4905615 --chain local-tableland --providerUrl http://127.0.0.1:8545 --privateKey 59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d

This assumes we have some file locally called data.csv in our current working directory, and the CSV should have raw data for the table that aligns to the columns. For example, let’s say our users table is a simple two column table an id INTEGER and val TEXT column. The CSV might look something like this, including the header row:

data.csv
id,val
1,'user_1'
2,'user_2'

This will populate the table accordingly and make it viewable in the Studio web app while inspecting the table deployment section.