SlicingDice API Docs

SlicingDice API Docs

Welcome to the SlicingDice API documentation. You'll find comprehensive guides and documentation to help you start working with SlicingDice as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Documentation

How to insert data

First time checking our docs? You might want to start with our Quickstart Guide.


Introduction

Data insertion is the action of storing data on SlicingDice. In fact, is the action of associating values to columns and entities. It's like inserting data on a spreadsheet or a regular database.

See below the similarity of a SQL database insert and the equivalent JSON for SlicingDice:

SQL Database Insertion
SlicingDice Insertion (JSON)
INSERT INTO YourSlicingDiceTable
(entity-id, name, age)
VALUES
('UUID-01', 'Jeff', 25);
{
    "UUID-01": {
        "name": "Jeff",
        "age": 25,
        "table": "YourSlicingDiceTable"
    }
}

Inserting data

In order to insert values to columns and entities, you only need to send a POST request to https://api.slicingdice.com/v1/insert with a JSON object where the key is the entity ID containing JSON objects with column names and their respective values.

Below is an insertion example to one entity (UUID-01), using three columns, which two of them are attribute columns (Name and Age) and one is an event column (Clicks).

Entities
Name
Age
Clicks

UUID-01

Jeff

25

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "name": "Jeff",
            "age": 25,
            "clicks": [
                {
                    "value": "Add to Cart",
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"
                }, {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"
                }
            ],
            "table": "users"
        },
        "auto-create": ["table", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY', uses_test_endpoint=True)

insert_data = {
    "UUID-01": {
        "table": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "auto-create": [
        "table", 
        "column"
    ]
}

print(slicingdice.insert(insert_data))

import com.slicingdice.jslicer.SlicingDice;
import java.io.IOException;
import org.json.JSONObject;
import org.json.JSONArray;

public class Example {
    public static void main(String[] args) throws IOException {
        SlicingDice slicingdice = new SlicingDice("MASTER_API_KEY", true);

        JSONObject insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("table", "users")
            .put("age", 25)
            .put("name", "Jeff")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}")
                    .put("value", "Add to Cart"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}")
                    .put("value", "Pay Now"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}")
                    .put("value", "Support"))))
        .put("auto-create", new JSONArray()
            .put("table")
            .put("column"));

        JSONObject result = slicingdice.insert(insertData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY', uses_test_endpoint: true)

insert_data = {
    "UUID-01" => {
        "table" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            }
        ]
    },
    "auto-create" => [
        "table", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

const usesTestEndpoint = true;
const slicingdice = new SlicingDice({masterKey: 'MASTER_API_KEY'}, usesTestEndpoint);

const insertData = {
    "UUID-01": {
        "table": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "auto-create": [
        "table", 
        "column"
    ]
};

slicingdice.insert(insertData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});

<?php
use Slicer\SlicingDice;
$usesTestEndpoint = true;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"), $usesTestEndpoint);

$insertData = array(
    "UUID-01" => array(
        "table" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            )
        )
    ),
    "auto-create" => array(
        "table", 
        "column"
    )
);

print_r($slicingdice->insert($insertData));
?>
using System.Collections.Generic;
using Slicer;
using Newtonsoft.Json;

namespace SlicerTester.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            var slicingdice = new SlicingDice(masterKey: "MASTER_API_KEY", usesTestEndpoint: true);

            var insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"table", "users"},
                    {"age", 25},
                    {"name", "Jeff"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"},
                            {"value", "Add to Cart"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"},
                            {"value", "Pay Now"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"},
                            {"value", "Support"}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "table", 
                    "column"
                }}
            };

            var result = slicingdice.Insert(insertData);
            System.Console.WriteLine(JsonConvert.SerializeObject(result).ToString());
        }
    }
}
package main
import (
    "fmt"
    "github.com/SlicingDice/slicingdice-go/slicingdice"
)
func main() {
    keys := new(slicingdice.APIKey)
    keys.MasterKey = "MASTER_API_KEY"
    slicingdice := slicingdice.New(keys, 60)
    slicingdice.Test = true

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "table": "users",
            "age": 25,
            "name": "Jeff",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                    "value": "Add to Cart",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                    "value": "Pay Now",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                    "value": "Support",
                },
            },
        },
        "auto-create": []interface{}{
            "table",
            "column",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}

After making an insertion request like this above, the API response will be in the format below:

{
    "status": "success",
    "inserted-entities": 1,
    "inserted-values": 5,
    "took": 0.014
}

Let's understand each component of the message:

  • status - Indicating whether the request was successfully processed or not.
  • inserted-entities - Total number of entities inserted for the given request.
  • inserted-values - Total number of values inserted, summing up from all entities, for the given request.
  • took - Time spent processing this request, in seconds.

Once SlicingDice receives your insertion request, it can take up to few seconds for your data to be available for querying due to our eventual consistency model.

Pro Tip

Remember that you can also use the /test endpoint https://api.slicingdice.com/v1/test/insert to make data insertions and queries before inserting real data to your production database.

Important

By default, all data inserted to SlicingDice is stored in lowercase only. Therefore, SlicingDice should not store data that must be case sensitive, such as passwords.


Attribute and Event Columns

Before explaining the difference between attribute and event columns, as data and code is worth more than 1,000 words, please take a look on this data table below:

User ID
Name
Age
Clicks

UUID-01

Jeff

25

Add to Cart - {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}
Support - {% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}

UUID-02

Michelle

32

Pay Now - {% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}

UUID-03

Lerry

47

Support - {% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}
Pay Now - {% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}

curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "UUID-01": {
            "name": "Jeff",
            "age": 25,
            "clicks": [
                {
                    "value": "Add to Cart",
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"
                }, {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"
                }
            ],
            "table": "users"
        },
        "UUID-02": {
            "name": "Michelle",
            "age": 32,
            "clicks": [
                {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}"
                }
            ],
            "table": "users"
        },
        "UUID-03": {
            "name": "Lerry",
            "age": 47,
            "clicks": [
                {
                    "value": "Support",
                    "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}"
                }, {
                    "value": "Pay Now",
                    "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}"
                }
            ],
            "table": "users"
        },
        "auto-create": ["table", "column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY', uses_test_endpoint=True)

insert_data = {
    "UUID-01": {
        "table": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "UUID-03": {
        "table": "users",
        "age": 47,
        "name": "Lerry",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value": "Support"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "UUID-02": {
        "table": "users",
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "auto-create": [
        "table", 
        "column"
    ]
}

print(slicingdice.insert(insert_data))

import com.slicingdice.jslicer.SlicingDice;
import java.io.IOException;
import org.json.JSONObject;
import org.json.JSONArray;

public class Example {
    public static void main(String[] args) throws IOException {
        SlicingDice slicingdice = new SlicingDice("MASTER_API_KEY", true);

        JSONObject insertData = new JSONObject()
        .put("UUID-01", new JSONObject()
            .put("table", "users")
            .put("age", 25)
            .put("name", "Jeff")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}")
                    .put("value", "Add to Cart"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}")
                    .put("value", "Pay Now"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}")
                    .put("value", "Support"))))
        .put("UUID-03", new JSONObject()
            .put("table", "users")
            .put("age", 47)
            .put("name", "Lerry")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}")
                    .put("value", "Support"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}")
                    .put("value", "Pay Now"))))
        .put("UUID-02", new JSONObject()
            .put("table", "users")
            .put("age", 32)
            .put("name", "Michelle")
            .put("clicks", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}")
                    .put("value", "Pay Now"))))
        .put("auto-create", new JSONArray()
            .put("table")
            .put("column"));

        JSONObject result = slicingdice.insert(insertData);
        System.out.println(result.toString());
    }
}
require 'rbslicer'
slicingdice = SlicingDice.new(master_key: 'MASTER_API_KEY', uses_test_endpoint: true)

insert_data = {
    "UUID-01" => {
        "table" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            }
        ]
    },
    "UUID-03" => {
        "table" => "users",
        "age" => 47,
        "name" => "Lerry",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value" => "Support"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value" => "Pay Now"
            }
        ]
    },
    "UUID-02" => {
        "table" => "users",
        "age" => 32,
        "name" => "Michelle",
        "clicks" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            }
        ]
    },
    "auto-create" => [
        "table", 
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

const usesTestEndpoint = true;
const slicingdice = new SlicingDice({masterKey: 'MASTER_API_KEY'}, usesTestEndpoint);

const insertData = {
    "UUID-01": {
        "table": "users",
        "age": 25,
        "name": "Jeff",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value": "Add to Cart"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value": "Pay Now"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value": "Support"
            }
        ]
    },
    "UUID-03": {
        "table": "users",
        "age": 47,
        "name": "Lerry",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value": "Support"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "UUID-02": {
        "table": "users",
        "age": 32,
        "name": "Michelle",
        "clicks": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value": "Pay Now"
            }
        ]
    },
    "auto-create": [
        "table", 
        "column"
    ]
};

slicingdice.insert(insertData).then((resp) => {
    console.log(resp);
}, (err) => {
    console.error(err);
});

<?php
use Slicer\SlicingDice;
$usesTestEndpoint = true;
$slicingdice = new SlicingDice(array("masterKey" => "MASTER_API_KEY"), $usesTestEndpoint);

$insertData = array(
    "UUID-01" => array(
        "table" => "users",
        "age" => 25,
        "name" => "Jeff",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                "value" => "Add to Cart"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                "value" => "Pay Now"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                "value" => "Support"
            )
        )
    ),
    "UUID-03" => array(
        "table" => "users",
        "age" => 47,
        "name" => "Lerry",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                "value" => "Support"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                "value" => "Pay Now"
            )
        )
    ),
    "UUID-02" => array(
        "table" => "users",
        "age" => 32,
        "name" => "Michelle",
        "clicks" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                "value" => "Pay Now"
            )
        )
    ),
    "auto-create" => array(
        "table", 
        "column"
    )
);

print_r($slicingdice->insert($insertData));
?>
using System.Collections.Generic;
using Slicer;
using Newtonsoft.Json;

namespace SlicerTester.Console
{
    class Program
    {
        static void Main(string[] args)
        {
            var slicingdice = new SlicingDice(masterKey: "MASTER_API_KEY", usesTestEndpoint: true);

            var insertData = new Dictionary<string, dynamic>{
                {"UUID-01", new Dictionary<string, dynamic>{
                    {"table", "users"},
                    {"age", 25},
                    {"name", "Jeff"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}"},
                            {"value", "Add to Cart"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}"},
                            {"value", "Pay Now"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}"},
                            {"value", "Support"}
                        }
                    }}
                }},
                {"UUID-03", new Dictionary<string, dynamic>{
                    {"table", "users"},
                    {"age", 47},
                    {"name", "Lerry"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}"},
                            {"value", "Support"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}"},
                            {"value", "Pay Now"}
                        }
                    }}
                }},
                {"UUID-02", new Dictionary<string, dynamic>{
                    {"table", "users"},
                    {"age", 32},
                    {"name", "Michelle"},
                    {"clicks", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}"},
                            {"value", "Pay Now"}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "table", 
                    "column"
                }}
            };

            var result = slicingdice.Insert(insertData);
            System.Console.WriteLine(JsonConvert.SerializeObject(result).ToString());
        }
    }
}
package main
import (
    "fmt"
    "github.com/SlicingDice/slicingdice-go/slicingdice"
)
func main() {
    keys := new(slicingdice.APIKey)
    keys.MasterKey = "MASTER_API_KEY"
    slicingdice := slicingdice.New(keys, 60)
    slicingdice.Test = true

    insertData := map[string]interface{}{
        "UUID-01": map[string]interface{}{
            "table": "users",
            "age": 25,
            "name": "Jeff",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %}",
                    "value": "Add to Cart",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-5d' %}",
                    "value": "Pay Now",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT17:05:25Z' '-2d' %}",
                    "value": "Support",
                },
            },
        },
        "UUID-03": map[string]interface{}{
            "table": "users",
            "age": 47,
            "name": "Lerry",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT00:41:34Z' '-1d' %}",
                    "value": "Support",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT09:41:17Z' '-3d' %}",
                    "value": "Pay Now",
                },
            },
        },
        "UUID-02": map[string]interface{}{
            "table": "users",
            "age": 32,
            "name": "Michelle",
            "clicks": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT16:21:16Z' '-4d' %}",
                    "value": "Pay Now",
                },
            },
        },
        "auto-create": []interface{}{
            "table",
            "column",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}

Suppose you have this data above. As you can see, the Clicks column is storing event data, and the other columns are storing attributes, like Name and Age.

That's basically the difference between Attribute Columns and Event Columns:

  • Attribute Column is a column type used to store any data not associated to a date/time. Example: storing the value Jeff for the Name column and the value 25 for the Age column. In this case both columns and their values are not associated to a specific date/time.

  • Event Column is column type used to store data that is associated to a date/time. Example: storing the value Add to Cart on the date/time {% convert_date 'YYYY-MM-DDT12:54:12Z' '-10d' %} for the Click event column. In this case it's important to know when the Add to Cart event happened.

For the event columns it is necessary to define the data retention time, that determines for how long the event column's data remain available for querying.

Check the docs for a detailed comparison on attribute and event columns.

Unlimited and Free Data Storage

Remember: The amount of data (values/rows) you insert for each column (attributes or events) will NOT impact on your monthly costs.


Entities

An entity is basically to "whom" the data will be associated and stored in the table.
They are like a primary key in relational databases.

To make things clear, let's use the same data table from the section above. As you can see, there are four User IDs on that table: UUID-01, UUID-02, UUID-03 and UUID-04. These User IDs are the Entity ID for whom you are going to insert the data (Name, Age and Clicks).

Every entity must have a unique ID: a string that uniquely identifies it. For instance, your users' email addresses or your server hostname (if you are storing server monitoring data) are perfect as unique entity IDs.

When you create a database or a table, SlicingDice automatically creates an Unique ID attribute column called Entity ID (with API name entity-id) for that table. This column will be transparently used by SlicingDice to store the value of all the entities you insert on the table. It's not possible to delete this column, although you can rename it.

Automatic Column and Table creation

By using the "auto-create": ["table", "column"] parameter when inserting data, SlicingDice will automatically create columns and tables that do not exist yet.
Check the docs on how to create columns for more details.


How to insert data

First time checking our docs? You might want to start with our Quickstart Guide.