Ingesting Data into Shaper
You can ingest data into Shaper’s database through the HTTP API. We create tables and add columns automatically based on the data ingested.
-
To ingest data you first need to create an API Key with “Ingest Data” permission in the “Admin” settings of the Shaper UI.
-
Then you can write JSON data to the HTTP API directly: Endpoint:
POST http://localhost:5454/api/data/:tablenameAuthentication is done through Bearer token in the Authorization header.
You can pass a single JSON object or an array of objects.
Example:
Terminal window curl -X POST http://localhost:5454/api/data/my_table \-H "Authorization: Bearer <your-api-key>" \-H "Content-Type: application/json" \-d '{"col1": "value1", "col2": 124}'Terminal window curl -X POST http://localhost:5454/api/data/my_table \-H "Authorization: Bearer <your-api-key>" \-H "Content-Type: application/json" \-d '[{"col1": "value1", "col2": 123}, {"col1": "value2", "col2": 456}]' -
If you click on “New” in the sidebar now, you can run the following query:
DESC my_table;SELECT * FROM my_table;column_name column_type null key default extra _idVARCHARYES_tsTIMESTAMPYEScol1VARCHARYEScol2DOUBLEYESYou can see that Shaper auto-creates columns with appropriate data types, and we always add
_idand_tscolumns. You can override the default values by passing data in the JSON object for them.Shaper detects boolean and numbers in JSON. We also detect date and timestamp strings in various formats. If any data is a complex data type such as an array or object, we store them as
JSONcolumn in DuckDB.
Automate Data Loading
Section titled “Automate Data Loading”Shaper supports tasks to automatically run SQL scripts in the background similar to CRON jobs.
Tasks are especially helpful to routinely load and cleanup data.
Learn more in the Tasks Documentation.