It is possible in Luzmo to create a dataset programmatically by sending a sample of data to the 'data' endpoint. By doing so, a dataset will be created in Luzmo, and the data will be stored in the Luzmo OLAP database.
This guide explains how to create a dataset for data push, i.e. you want to push your data to Luzmo and have it stored in our OLAP optimized database. If you are instead looking to create a dataset based on your connection to your database or plugin, refer to the dataprovider endpoint .
The example code below will create a new dataset and 4 columns.
To give names to your dataset and columns, the header array and name property need to be filled in.
The data sample will be analyzed to determine the types of the different columns. To make sure that the types are detected correctly, it is advised to send a sample for the initial creation where each column has at least a few values.
The format of the data sample is an array of arrays. Each inner array represents one row of data, and each element inside of it is the value per column.
This means that each inner array should consist of the same number of elements as there are columns (as defined in the header array), and the position of the data inside the array determines to which column they will be attributed.
There is a limit of pushing 10000 data points (i.e. rows) per call and a storage limit which can be found in our licensing information.
Behind the scenes, this call is creating a securable of type dataset and columns, and associating them.
After initially creating the dataset, you can now append or replace the data in the dataset by following the Pushing data guide.
import Luzmo from '@luzmo/nodejs-sdk';
const client = new Luzmo({
api_key: '<your Luzmo API key>',
api_token: '<your Luzmo API token>',
host: 'https://api.luzmo.com'
});
const response = await client.create('data',
{
type: "create",
data: [
[
"Chicken baconito ",
"3",
"500",
"menu"
],
[
"Quesarito",
"3.5",
"700",
"menu"
]
],
options: {
update_metadata: true,
header: [
"Burrito",
"price",
"weight",
"order type"
],
name: {
en: "Burritos"
}
}
}
);