Skip to content

Create a Database

This page guides you through the steps to create a database and add it to a package, using the kdb Insights Enterprise Web Interface.

The Build a database section guides you through building the insights-demo database and adding it to the insights-demo package.

Details on how to set up pipelines and ingest data into this database are provided in the other walkthroughs.

Create a database

This section explains how to create a new database, add it to a package, and set up the schema for the new database in the Insights Enterprise Web Interface.

  1. On the Overview page, choose Create new under Databases in the Quick Actions section.

    Select a build a database.

  2. In the Create Database dialog set the following values:

    Setting Value
    Database Name insights-demo
    Select a Package Create new package
    Package Name insights-demo
  3. Click Create.

    Create insights-demo

  4. On the Schema Settings tab click Code View to open the Schema Code View. You can use this to add large schema tables, in JSON format.

  5. Replace the existing code with the following JSON.

    insights-demo schema

    This JSON code is used in all the walkthrough examples that use the insights-demo database.

    [
        {
            "name": "weather",
            "type": "partitioned",
            "primaryKeys": [],
            "prtnCol": "timestamp",
            "sortColsDisk": ["airtemp"],
            "sortColsMem": ["timestamp"],
            "sortColsOrd": ["sensor"],
            "columns": [
            {
                "type": "timestamp",
                "name": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "sensor",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "sorted",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "airtemp",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "sorted",
                "compound": false
            },
            {
                "name": "name",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "borough",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "longitude",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "latitude",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "color",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            }
            ]
        },
        {
            "columns": [
            {
                "type": "symbol",
                "name": "trip_id",
                "attrMem": "sorted",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "arrival_time",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "sorted",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "stop_id",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "sorted",
                "compound": false
            },
            {
                "name": "stop_sequence",
                "type": "long",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "stop_name",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "stop_lat",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "stop_lon",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_id",
                "type": "long",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "trip_headsign",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "direction_id",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_short_name",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_long_name",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_desc",
                "type": "string",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_type",
                "type": "long",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_url",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "route_color",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            }
            ],
            "primaryKeys": [],
            "type": "partitioned",
            "prtnCol": "arrival_time",
            "name": "subway",
            "sortColsDisk": ["stop_id"],
            "sortColsMem": ["trip_id"],
            "sortColsOrd": ["arrival_time"]
        },
        {
            "columns": [
            {
                "type": "string",
                "name": "name",
                "attrMem": "sorted",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "lat",
                "type": "float",
                "attrMem": "",
                "attrOrd": "sorted",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "long",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "sorted",
                "compound": false
            },
            {
                "name": "neighborhood",
                "type": "string",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "airquality",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "trafficcongestion",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "bikeacccnt",
                "type": "int",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "caracccnt",
                "type": "int",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "timestamp",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            }
            ],
            "primaryKeys": [],
            "type": "partitioned",
            "prtnCol": "timestamp",
            "name": "health",
            "sortColsDisk": ["long"],
            "sortColsMem": ["name"],
            "sortColsOrd": ["lat"]
        },
        {
            "columns": [
            {
                "type": "symbol",
                "name": "event_id",
                "attrMem": "sorted",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "incident_time",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "sorted",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "nypd_precinct",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "sorted",
                "compound": false
            },
            {
                "name": "borough",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "patrol_borough",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "call_x_geo",
                "type": "long",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "call_y_geo",
                "type": "long",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "radio_code",
                "type": "symbol",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "description",
                "type": "string",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "crime_in_progress",
                "type": "string",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "call_timestamp",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "dispatch_timestamp",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "arrival_timestamp",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "closing_timestamp",
                "type": "timestamp",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "latitude",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            },
            {
                "name": "longitude",
                "type": "float",
                "attrMem": "",
                "attrOrd": "",
                "attrDisk": "",
                "compound": false
            }
            ],
            "primaryKeys": [],
            "type": "partitioned",
            "prtnCol": "arrival_timestamp",
            "name": "crime",
            "sortColsDisk": ["nypd_precinct"],
            "sortColsMem": ["event_id"],
            "sortColsOrd": ["incident_time"]
        }
        ]
    
  6. Click Apply to setup the database schema.

  7. Click Save.

    A database with four schema tables.

  8. Navigate to the Package index to see the package containing the database.

    Packages Index

  9. Next, create pipelines to ingest data into this database:

Further reading

Use the following links to learn more about specific topics mentioned in this page: