SlicingDice Documentation

SlicingDice - The All-in-One Solution Documentation

Welcome to the SlicingDice 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    Guides

5.2 Using "auto-create" column

Auto create is a feature in SlicingDice's Database to make things easier for you, this property when activated will create all the necessary columns automatically if they not exist yet when you make an insertion. In this guide, we will give more details of the auto-create feature.

Introduction

When the auto-create property is activated, the database will create new columns for every new column name it finds when inserting data. To this goal, the database must pick values for some or all of the following attributes of the column: name, api-name, description, type and storage.

The first three parameters are quite easy to solve: name and api-name are both set to the new column name that triggered auto-creation, while description is set to a default text explaining that the column was automatically created. The tricky part is getting the correct type and storage.

Auto-create on SQL Drivers

If you're using the API-based SQL endpoint you need to add the parameter auto_create=true (https://api.slicingdice.com/v1/sql?auto_create=true) on the endpoint and if you're using the JDBC driver you will need to include the following property on your connection properties ;Other="EnforceTableSchema=false".

Auto-create on API-based

Auto-creation of columns can be triggered by adding "auto-create": ["column"] to the outermost level of an API-based insert command.


String data type

There are two ways to insert data and trigger the creation of a string column, and each syntax will produce a column with different settings for storage property.

Latest-value storage

When the value is a single string, the database will create a latest-value string column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], state) VALUES ("Entity1", "CA");
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], state) VALUES ("Entity1", "CA");'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "state": "CA"
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "state": "CA"
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("state", "CA"))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "state" => "CA"
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "state": "CA"
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "state" => "CA"
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"state", "CA"}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "state": "CA",
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

List-of-value storage

When the value is a list of strings, the database will create a list-of-values string column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [has-lived-at-country], [has-lived-at-state]) VALUES ("Entity1", '["USA"]', '["CA", "NY", "TX"]');
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [has-lived-at-country], [has-lived-at-state]) VALUES ("Entity1", '["USA"]', '["CA", "NY", "TX"]');'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "has-lived-at-state": ["CA", "NY", "TX"],
            "has-lived-at-country": ["USA"]
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "has-lived-at-country": [
            "USA"
        ],
        "has-lived-at-state": [
            "CA", 
            "NY", 
            "TX"
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("has-lived-at-country", new JSONArray()
                .put("USA"))
            .put("has-lived-at-state", new JSONArray()
                .put("CA")
                .put("NY")
                .put("TX")))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "has-lived-at-country" => [
            "USA"
        ],
        "has-lived-at-state" => [
            "CA", 
            "NY", 
            "TX"
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "has-lived-at-country": [
            "USA"
        ],
        "has-lived-at-state": [
            "CA", 
            "NY", 
            "TX"
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "has-lived-at-country" => array(
            "USA"
        ),
        "has-lived-at-state" => array(
            "CA", 
            "NY", 
            "TX"
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"has-lived-at-country", new List<dynamic>{
                        "USA"
                    }},
                    {"has-lived-at-state", new List<dynamic>{
                        "CA", 
                        "NY", 
                        "TX"
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "has-lived-at-country": []interface{}{
                "USA",
            },
            "has-lived-at-state": []interface{}{
                "CA",
                "NY",
                "TX",
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Note that "field-name":["a-value"] creates a storage=list-of-values while "field-name":"a-value" creates a storage=latest-value.


String-event data type

In the following example, there are four ways of auto-creating an event string column.
All of these four ways create columns with exact same properties. The first two do not explicitly declare a date key and then, the server current timezone UTC is used.
The last two are simply a repetition of the first two formats, but this time including the date key.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [url-access.0.value], [img-view.0.value], [img-view.1.value], [link-click.0.value], [link-click.0.date], [word-typed.0.value], [word-typed.0.date], [word-typed.1.value], [word-typed.1.date]) VALUES ("Entity1", "urlA", "urlA", "urlB", "linkA", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", "wordA", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", "wordB", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}");
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [url-access.0.value], [img-view.0.value], [img-view.1.value], [link-click.0.value], [link-click.0.date], [word-typed.0.value], [word-typed.0.date], [word-typed.1.value], [word-typed.1.date]) VALUES ("Entity1", "urlA", "urlA", "urlB", "linkA", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", "wordA", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", "wordB", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}");'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "url-access": {"value":"urlA"},
            "img-view": [
              {"value":"urlA"},
              {"value":"urlB"}
              ],
            "link-click": {
              "value":"linkA",
              "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
              },
            "word-typed": [
            	{
            	  "value":"wordA",
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
            	},
              {
            	  "value":"wordB",
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
            	}
             ]
         },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "url-access": {
            "value": "urlA"
        },
        "link-click": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": "linkA"
        },
        "img-view": [
            {
                "value": "urlA"
            }, 
            {
                "value": "urlB"
            }
        ],
        "word-typed": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": "wordA"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": "wordB"
            }
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("url-access", new JSONObject()
                .put("value", "urlA"))
            .put("link-click", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                .put("value", "linkA"))
            .put("img-view", new JSONArray()
                .put(new JSONObject()
                    .put("value", "urlA"))
                .put(new JSONObject()
                    .put("value", "urlB")))
            .put("word-typed", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                    .put("value", "wordA"))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                    .put("value", "wordB"))))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "url-access" => {
            "value" => "urlA"
        },
        "link-click" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => "linkA"
        },
        "img-view" => [
            {
                "value" => "urlA"
            }, 
            {
                "value" => "urlB"
            }
        ],
        "word-typed" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => "wordA"
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => "wordB"
            }
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "url-access": {
            "value": "urlA"
        },
        "link-click": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": "linkA"
        },
        "img-view": [
            {
                "value": "urlA"
            }, 
            {
                "value": "urlB"
            }
        ],
        "word-typed": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": "wordA"
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": "wordB"
            }
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "url-access" => array(
            "value" => "urlA"
        ),
        "link-click" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => "linkA"
        ),
        "img-view" => array(
            array(
                "value" => "urlA"
            ), 
            array(
                "value" => "urlB"
            )
        ),
        "word-typed" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => "wordA"
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => "wordB"
            )
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"url-access", new Dictionary<string, dynamic>{
                        {"value", "urlA"}
                    }},
                    {"link-click", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                        {"value", "linkA"}
                    }},
                    {"img-view", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"value", "urlA"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"value", "urlB"}
                        }
                    }},
                    {"word-typed", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                            {"value", "wordA"}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                            {"value", "wordB"}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "url-access": map[string]interface{}{
                "value": "urlA",
            },
            "link-click": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": "linkA",
            },
            "img-view": []interface{}{
                map[string]interface{}{
                    "value": "urlA",
                },
                map[string]interface{}{
                    "value": "urlB",
                },
            },
            "word-typed": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                    "value": "wordA",
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                    "value": "wordB",
                },
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Note that "column-name": [{"value":"a-value"}] creates an event string column, while "column-name": ["a-value"] creates a storage=list-of-values string column.


Integer data type

Similar to a string column, but values are non-decimal points numbers.

As in the case of a string column, there are two acceptable syntaxes, each one producing a different setting for storage property.

Latest-value storage

When the value is a single integer, the database will create a latest-value integer column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], age) VALUES ("Entity1", 23);
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], age) VALUES ("Entity1", 23);'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "current-age": 23
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "current-age": 23
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("current-age", 23))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "current-age" => 23
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "current-age": 23
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "current-age" => 23
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"current-age", 23}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "current-age": 23,
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

List-of-values storage

When the value is a list of integers, the database will create a list-of-values integer column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [lotery-numbers]) VALUES ("Entity1", '[4, 8, 15, 16, 23, 42]');
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [lotery-numbers]) VALUES ("Entity1", '[4, 8, 15, 16, 23, 42]');'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "lotery-numbers": [4, 8, 15, 16, 23, 42]
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "lotery-numbers": [
            4, 
            8, 
            15, 
            16, 
            23, 
            42
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("lotery-numbers", new JSONArray()
                .put(4)
                .put(8)
                .put(15)
                .put(16)
                .put(23)
                .put(42)))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "lotery-numbers" => [
            4, 
            8, 
            15, 
            16, 
            23, 
            42
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "lotery-numbers": [
            4, 
            8, 
            15, 
            16, 
            23, 
            42
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "lotery-numbers" => array(
            4, 
            8, 
            15, 
            16, 
            23, 
            42
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"lotery-numbers", new List<dynamic>{
                        4, 
                        8, 
                        15, 
                        16, 
                        23, 
                        42
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "lotery-numbers": []interface{}{
                4,
                8,
                15,
                16,
                23,
                42,
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Integer-event data type

In the following example, there are four ways of auto-creating an event integer column. All of these four ways create columns with exact same properties.
The first two do not explicitly declare a date key, and the server current timezone UTC is used. The last two are simply a repetition of the first two formats, but this time including the date key.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [cpu-A-temperature.0.value], [cpu-B-temperature.0.value], [cpu-B-temperature.1.value], [cpu-C-temperature.0.value], [cpu-C-temperature.0.date], [cpu-D-temperature.0.value], [cpu-D-temperature.0.date], [cpu-D-temperature.1.value], [word-typed.1.date]) VALUES ("Entity1", 25, 25, 27, 25, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 25, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 27, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [cpu-A-temperature.0.value], [cpu-B-temperature.0.value], [cpu-B-temperature.1.value], [cpu-C-temperature.0.value], [cpu-C-temperature.0.date], [cpu-D-temperature.0.value], [cpu-D-temperature.0.date], [cpu-D-temperature.1.value], [word-typed.1.date]) VALUES ("Entity1", 25, 25, 27, 25, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 25, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 27, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}");'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "cpu-A-temperature": {"value":25},
            "cpu-B-temperature": [
              {"value":25},
              {"value":27}
              ],
            "cpu-C-temperature": {
              "value":25,
              "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
              },
            "cpu-D-temperature": [
            	{
            	  "value":25,
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
            	},
              {
            	  "value":27,
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}"
            	}
             ]
         },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "cpu-D-temperature": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value": 27
            }
        ],
        "cpu-A-temperature": {
            "value": 25
        },
        "cpu-C-temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": 25
        },
        "cpu-B-temperature": [
            {
                "value": 25
            }, 
            {
                "value": 27
            }
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("cpu-D-temperature", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                    .put("value", 25))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}")
                    .put("value", 27)))
            .put("cpu-A-temperature", new JSONObject()
                .put("value", 25))
            .put("cpu-C-temperature", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                .put("value", 25))
            .put("cpu-B-temperature", new JSONArray()
                .put(new JSONObject()
                    .put("value", 25))
                .put(new JSONObject()
                    .put("value", 27))))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "cpu-D-temperature" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => 25
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value" => 27
            }
        ],
        "cpu-A-temperature" => {
            "value" => 25
        },
        "cpu-C-temperature" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => 25
        },
        "cpu-B-temperature" => [
            {
                "value" => 25
            }, 
            {
                "value" => 27
            }
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "cpu-D-temperature": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value": 27
            }
        ],
        "cpu-A-temperature": {
            "value": 25
        },
        "cpu-C-temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": 25
        },
        "cpu-B-temperature": [
            {
                "value": 25
            }, 
            {
                "value": 27
            }
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "cpu-D-temperature" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => 25
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value" => 27
            )
        ),
        "cpu-A-temperature" => array(
            "value" => 25
        ),
        "cpu-C-temperature" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => 25
        ),
        "cpu-B-temperature" => array(
            array(
                "value" => 25
            ), 
            array(
                "value" => 27
            )
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"cpu-D-temperature", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                            {"value", 25}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}"},
                            {"value", 27}
                        }
                    }},
                    {"cpu-A-temperature", new Dictionary<string, dynamic>{
                        {"value", 25}
                    }},
                    {"cpu-C-temperature", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                        {"value", 25}
                    }},
                    {"cpu-B-temperature", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"value", 25}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"value", 27}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "cpu-D-temperature": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                    "value": 25,
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                    "value": 27,
                },
            },
            "cpu-A-temperature": map[string]interface{}{
                "value": 25,
            },
            "cpu-C-temperature": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25,
            },
            "cpu-B-temperature": []interface{}{
                map[string]interface{}{
                    "value": 25,
                },
                map[string]interface{}{
                    "value": 27,
                },
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Decimal data type

Decimal is simply a numeric value with a decimal point, such as 142.45. By default, the column will be created with 5 decimal places and latest-value column storage configuration. However, if your value has more than 5 places, the column will be created with enough places to fit your data.

As in the case of the string column, there are two acceptable syntaxes, each one producing a different setting for storage.

Latest-value storage

When the value is a single decimal, the database will create a latest-value decimal column.

INSERT INTO default ([entity-id], height) VALUES ("Entity1", 188.5);
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], height) VALUES ("Entity1", 188.5);'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "heigth": 188.5
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "heigth": 188.5
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("heigth", 188.5))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "heigth" => 188.5
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "heigth": 188.5
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "heigth" => 188.5
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"heigth", 188.5}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "heigth": 188.5,
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

List-of-values storage

When the value is a list of decimals, the databae will create a list-of-values decimal column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [purchased-values]) VALUES ("Entity1", '[99.9, 103.58, 155.65]');
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [purchased-values]) VALUES ("Entity1", '[99.9, 103.58, 155.65]');'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "purchased-values": [99.9, 103.58, 155.65]
        },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "purchased-values": [
            99.9, 
            103.58, 
            155.65
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("purchased-values", new JSONArray()
                .put(99.9)
                .put(103.58)
                .put(155.65)))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "purchased-values" => [
            99.9, 
            103.58, 
            155.65
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "purchased-values": [
            99.9, 
            103.58, 
            155.65
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "purchased-values" => array(
            99.9, 
            103.58, 
            155.65
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"purchased-values", new List<dynamic>{
                        99.9, 
                        103.58, 
                        155.65
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "purchased-values": []interface{}{
                99.9,
                103.58,
                155.65,
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Decimal-event data type

Similar to integer-event, but values are numbers with a decimal point. By default, the column will be created with 5 decimal places. However, if your value has more than 5 places, the column will be created with enough places to fit your data.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [cpu-A-temperature.0.value], [cpu-B-temperature.0.value], [cpu-B-temperature.1.value], [cpu-C-temperature.0.value], [cpu-C-temperature.0.date], [cpu-D-temperature.0.value], [cpu-D-temperature.0.date], [cpu-D-temperature.1.value], [word-typed.1.date]) VALUES ("Entity1", 25.0, 25.0, 27.0, 25.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 25.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 27.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [cpu-A-temperature.0.value], [cpu-B-temperature.0.value], [cpu-B-temperature.1.value], [cpu-C-temperature.0.value], [cpu-C-temperature.0.date], [cpu-D-temperature.0.value], [cpu-D-temperature.0.date], [cpu-D-temperature.1.value], [word-typed.1.date]) VALUES ("Entity1", 25.0, 25.0, 27.0, 25.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 25.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}", 27.0, "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "cpu-A-temperature": {"value":25.0},
            "cpu-B-temperature": [
              {"value":25.0},
              {"value":27.0}
              ],
            "cpu-C-temperature": {
              "value":25.0,
              "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
              },
            "cpu-D-temperature": [
            	{
            	  "value":25.0,
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"
            	},
              {
            	  "value":27.0,
            	  "date":"{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}"
            	}
             ]
         },
        "auto-create": ["column"]
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "cpu-D-temperature": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25.0
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value": 27.0
            }
        ],
        "cpu-A-temperature": {
            "value": 25.0
        },
        "cpu-C-temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": 25.0
        },
        "cpu-B-temperature": [
            {
                "value": 25.0
            }, 
            {
                "value": 27.0
            }
        ]
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("cpu-D-temperature", new JSONArray()
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                    .put("value", 25.0))
                .put(new JSONObject()
                    .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}")
                    .put("value", 27.0)))
            .put("cpu-A-temperature", new JSONObject()
                .put("value", 25.0))
            .put("cpu-C-temperature", new JSONObject()
                .put("date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}")
                .put("value", 25.0))
            .put("cpu-B-temperature", new JSONArray()
                .put(new JSONObject()
                    .put("value", 25.0))
                .put(new JSONObject()
                    .put("value", 27.0))))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "cpu-D-temperature" => [
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => 25.0
            }, 
            {
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value" => 27.0
            }
        ],
        "cpu-A-temperature" => {
            "value" => 25.0
        },
        "cpu-C-temperature" => {
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => 25.0
        },
        "cpu-B-temperature" => [
            {
                "value" => 25.0
            }, 
            {
                "value" => 27.0
            }
        ]
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "cpu-D-temperature": [
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25.0
            }, 
            {
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value": 27.0
            }
        ],
        "cpu-A-temperature": {
            "value": 25.0
        },
        "cpu-C-temperature": {
            "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value": 25.0
        },
        "cpu-B-temperature": [
            {
                "value": 25.0
            }, 
            {
                "value": 27.0
            }
        ]
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "cpu-D-temperature" => array(
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value" => 25.0
            ), 
            array(
                "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                "value" => 27.0
            )
        ),
        "cpu-A-temperature" => array(
            "value" => 25.0
        ),
        "cpu-C-temperature" => array(
            "date" => "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
            "value" => 25.0
        ),
        "cpu-B-temperature" => array(
            array(
                "value" => 25.0
            ), 
            array(
                "value" => 27.0
            )
        )
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"cpu-D-temperature", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                            {"value", 25.0}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}"},
                            {"value", 27.0}
                        }
                    }},
                    {"cpu-A-temperature", new Dictionary<string, dynamic>{
                        {"value", 25.0}
                    }},
                    {"cpu-C-temperature", new Dictionary<string, dynamic>{
                        {"date", "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}"},
                        {"value", 25.0}
                    }},
                    {"cpu-B-temperature", new List<dynamic>{
                        new Dictionary<string, dynamic>{
                            {"value", 25.0}
                        }, 
                        new Dictionary<string, dynamic>{
                            {"value", 27.0}
                        }
                    }}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "cpu-D-temperature": []interface{}{
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                    "value": 25.0,
                },
                map[string]interface{}{
                    "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-2d' %}",
                    "value": 27.0,
                },
            },
            "cpu-A-temperature": map[string]interface{}{
                "value": 25.0,
            },
            "cpu-C-temperature": map[string]interface{}{
                "date": "{% convert_date 'YYYY-MM-DDT10:22:10Z' '-1d' %}",
                "value": 25.0,
            },
            "cpu-B-temperature": []interface{}{
                map[string]interface{}{
                    "value": 25.0,
                },
                map[string]interface{}{
                    "value": 27.0,
                },
            },
        },
        "auto-create": []interface{}{
            "column",
        },
    }

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

Mind your 0!

"value":0.0 will trigger the creation of a decimal-event while "value":0 will trigger creation of a integer-event.


Boolean data type

A particular case of string type where the first value is either the string "true" or "false". Since the database is case insensitive, "True" and "False" are also accepted, as any other form of capitalization of these strings.

As in the case of string type, two syntaxes are possible, each producing a different storage configuration.

$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "is-online": "true"
        },
        "auto-create": ["column"]
    }'
$ curl -X POST https://api.slicingdice.com/v1/test/sql?auto_create=true \
    -H 'Authorization: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfX3NhbHQiOiJkZW1vODltIiwicGVybWlzc2lvbl9sZXZlbCI6MywicHJvamVjdF9pZCI6MjUwLCJjbGllbnRfaWQiOjEwfQ.T6MaP6Xoh7wSklfr7vB7jY52DdhYLn_oz1UyJgG0M0A' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [is-online) VALUES ("Entity1", "true");'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "is-online": "true"
    },
    "auto-create": [
        "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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("is-online", "true"))
        .put("auto-create", new JSONArray()
            .put("column"));

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

insert_data = {
    "Entity1" => {
        "is-online" => "true"
    },
    "auto-create" => [
        "column"
    ]
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "is-online": "true"
    },
    "auto-create": [
        "column"
    ]
};

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

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

$insertData = array(
    "Entity1" => array(
        "is-online" => "true"
    ),
    "auto-create" => array(
        "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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"is-online", "true"}
                }},
                {"auto-create", new List<dynamic>{
                    "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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "is-online": "true",
        },
        "auto-create": []interface{}{
            "column",
        },
    }

    fmt.Println(slicingdice.Insert(insertData))
}
/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [is-online) VALUES ("Entity1", "true");

Date data type

A particular case of string type where the first value is seen on the ISO format YYYY-MM-DD.

As in the case of string type, two syntaxes are possible, each producing a different storage configuration.

Latest-value

When the value is a single date, the database will create a latest-value date column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [user-birthdate]) VALUES ("Entity1", "1987-03-07");
$ curl -X POST https://api.slicingdice.com/v1/sql?auto_create=true \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [user-birthdate]) VALUES ("Entity1", "1987-03-07");'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "user-birthdate": "1987-03-07"
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "user-birthdate": "1987-03-07"
    }
}

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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("user-birthdate", "1987-03-07"));

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

insert_data = {
    "Entity1" => {
        "user-birthdate" => "1987-03-07"
    }
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "user-birthdate": "1987-03-07"
    }
};

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

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

$insertData = array(
    "Entity1" => array(
        "user-birthdate" => "1987-03-07"
    )
);

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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"user-birthdate", "1987-03-07"}
                }}
            };

            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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "user-birthdate": "1987-03-07",
        },
    }

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

List-of-values

When the value is a list of dates, the database will create a list-of-values date column.

/* remember to add ;Other="EnforceTableSchema=false" to your connection properties */
INSERT INTO default ([entity-id], [tests-dates]]) VALUES ("Entity1", '["2017-01-03", "2017-02-07", "2017-03-15", "2017-04-01"]');
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [tests-dates]]) VALUES ("Entity1", '["2017-01-03", "2017-02-07", "2017-03-15", "2017-04-01"]');'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
        "tests-dates": [
            "2017-01-03",
            "2017-02-07",
            "2017-03-15",
            "2017-04-01"
            ]
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "tests-dates": [
            "2017-01-03", 
            "2017-02-07", 
            "2017-03-15", 
            "2017-04-01"
        ]
    }
}

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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("tests-dates", new JSONArray()
                .put("2017-01-03")
                .put("2017-02-07")
                .put("2017-03-15")
                .put("2017-04-01")));

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

insert_data = {
    "Entity1" => {
        "tests-dates" => [
            "2017-01-03", 
            "2017-02-07", 
            "2017-03-15", 
            "2017-04-01"
        ]
    }
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "tests-dates": [
            "2017-01-03", 
            "2017-02-07", 
            "2017-03-15", 
            "2017-04-01"
        ]
    }
};

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

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

$insertData = array(
    "Entity1" => array(
        "tests-dates" => array(
            "2017-01-03", 
            "2017-02-07", 
            "2017-03-15", 
            "2017-04-01"
        )
    )
);

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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"tests-dates", new List<dynamic>{
                        "2017-01-03", 
                        "2017-02-07", 
                        "2017-03-15", 
                        "2017-04-01"
                    }}
                }}
            };

            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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "tests-dates": []interface{}{
                "2017-01-03",
                "2017-02-07",
                "2017-03-15",
                "2017-04-01",
            },
        },
    }

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

Datetime data type

A particular case of string type where the first value is seen on the ISO format YYYY-MM-DDTHH:MM:SSZ.

As in the case of string type, two syntaxes are possible, each producing a different storage configuration.

Latest-value

When the value is a single datetime, the database will create a latest-value datetime column.

INSERT INTO default ([entity-id], [signup-time]) VALUES ("Entity1", "2018-05-30T15:22:50Z");
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [signup-time]) VALUES ("Entity1", "2018-05-30T15:22:50Z");'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
            "signup-time": "2018-05-30T15:22:50Z"
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "signup-time": "2018-05-30T15:22:50Z"
    }
}

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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("signup-time", "2018-05-30T15:22:50Z"));

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

insert_data = {
    "Entity1" => {
        "signup-time" => "2018-05-30T15:22:50Z"
    }
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "signup-time": "2018-05-30T15:22:50Z"
    }
};

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

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

$insertData = array(
    "Entity1" => array(
        "signup-time" => "2018-05-30T15:22:50Z"
    )
);

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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"signup-time", "2018-05-30T15:22:50Z"}
                }}
            };

            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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "signup-time": "2018-05-30T15:22:50Z",
        },
    }

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

List-of-values

When the value is a list of datetimes, the database will create a list-of-values datetime column.

INSERT INTO default ([entity-id], [login-times]]) VALUES ("Entity1", '["2018-05-30T15:22:50Z","2018-06-01T08:15:25Z","2018-06-06T10:00:00Z","2018-07-21T19:25:15Z"]');
$ curl -X POST https://api.slicingdice.com/v1/sql \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/sql' \
    -d 'INSERT INTO default ([entity-id], [login-times]]) VALUES ("Entity1", '["2017-01-03", "2017-02-07", "2017-03-15", "2017-04-01"]');'
$ curl -X POST https://api.slicingdice.com/v1/insert \
    -H 'Authorization: MASTER_OR_WRITE_API_KEY' \
    -H 'Content-Type: application/json' \
    -d '{
        "Entity1": {
        "login-times": [
            "2018-05-30T15:22:50Z",
            "2018-06-01T08:15:25Z",
            "2018-06-06T10:00:00Z",
            "2018-07-21T19:25:15Z"
        ]
        }
    }'
from pyslicer import SlicingDice
slicingdice = SlicingDice(master_key='MASTER_API_KEY')

insert_data = {
    "Entity1": {
        "login-times": [
            "2018-05-30T15:22:50Z",
            "2018-06-01T08:15:25Z",
            "2018-06-06T10:00:00Z",
            "2018-07-21T19:25:15Z"
        ]
    }
}

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");

        JSONObject insertData = new JSONObject()
        .put("Entity1", new JSONObject()
            .put("login-times", new JSONArray()
                .put("2018-05-30T15:22:50Z"),
                .put("2018-06-01T08:15:25Z"),
                .put("2018-06-06T10:00:00Z"),
                .put("2018-07-21T19:25:15Z")));

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

insert_data = {
    "Entity1" => {
        "login-times" => [
            "2018-05-30T15:22:50Z",
            "2018-06-01T08:15:25Z",
            "2018-06-06T10:00:00Z",
            "2018-07-21T19:25:15Z"
        ]
    }
}

puts slicingdice.insert(insert_data)

const SlicingDice = require('slicerjs');

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

const insertData = {
    "Entity1": {
        "login-times": [
            "2018-05-30T15:22:50Z",
            "2018-06-01T08:15:25Z",
            "2018-06-06T10:00:00Z",
            "2018-07-21T19:25:15Z"
        ]
    }
};

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

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

$insertData = array(
    "Entity1" => array(
        "login-times" => array(
            "2018-05-30T15:22:50Z",
            "2018-06-01T08:15:25Z",
            "2018-06-06T10:00:00Z",
            "2018-07-21T19:25:15Z"
        )
    )
);

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");

            var insertData = new Dictionary<string, dynamic>{
                {"Entity1", new Dictionary<string, dynamic>{
                    {"login-times", new List<dynamic>{
                        "2018-05-30T15:22:50Z",
                        "2018-06-01T08:15:25Z",
                        "2018-06-06T10:00:00Z",
                        "2018-07-21T19:25:15Z"
                    }}
                }}
            };

            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)

    insertData := map[string]interface{}{
        "Entity1": map[string]interface{}{
            "login-times": []interface{}{
                "2018-05-30T15:22:50Z",
                "2018-06-01T08:15:25Z",
                "2018-06-06T10:00:00Z",
                "2018-07-21T19:25:15Z",
            },
        },
    }

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

Unique ID data type

Unique ID column cannot be automatically created because there is no way to differentiate between a string and a unique-id automatically.


Geolocation data type

Not supported (yet)

The automatic creation of geolocation data types is not supported at the moment. But we're working to support the auto-creation of geolocation and geolocation-event data types.