1. Connect Data

To perform analytics with GoodData, you must first establish a connection to a database. This process involves creating a data source object in GoodData, which represents the external database containing your source data. We query your database in real time to compute analytics, and only cache the results.

This tutorial uses our sample Snowflake database. However, you are welcome to connect to any of the supported databases or upload a CSV file. For the best learning experience, we recommend completing this tutorial with the sample Snowflake database before using your own data.

UI
API

Steps:

  1. Go to Data sources and click Connect data.

    Screenshot of the Connect data page.
  2. Select the type of database you are using, we recommend connecting to our sample Snowflake database.

    Screenshot of the Connect data dialog.
  3. Name your data source, fill in the connection credentials:

    • Account Name: gooddata
    • Username: gooddata_demo
    • Password: 4m62f7hSXAayAisZ
    • Database name: GOODDATA_DEMO_DATABASE
    • Warehouse: GOODDATA_DEMO_WAREHOUSE

    and click Connect.

    Screenshot of the Data source creation dialog.
  4. Fill in the schema name ECOMMERCE_DEMO_SCHEMA and click Save.

    Screenshot of the second part of the Data source creation dialog.

    The data source is created and appears in the list of data sources.

    Screenshot of Data source page listing the newly created data source.

You can connect to our sample Snowflake database using the following API call:

curl $HOST_URL/api/v1/entities/dataSources \
  -H "Content-Type: application/vnd.gooddata.api+json" \
  -H "Accept: application/vnd.gooddata.api+json" \
  -H "Authorization: Bearer <API_TOKEN>" \
  -X POST \
  -d '{
      "data": {
          "attributes": {
              "name": "Demo Snowflake DB",
              "url": "jdbc:snowflake://gooddata.snowflakecomputing.com?warehouse=GOODDATA_DEMO_WAREHOUSE&db=GOODDATA_DEMO_DATABASE",
              "schema": "ECOMMERCE_DEMO_SCHEMA",
              "type": "SNOWFLAKE",
              "username": "gooddata_demo",
              "password": "4m62f7hSXAayAisZ"
          },
          "id": "demo-ds",
          "type": "dataSource"
      }
  }' | jq .

To confirm that the database has been connected, the server returns the following response:

{
  "data": {
    "id": "demo-ds",
    "type": "dataSource",
    "attributes": {
      "name": "Demo Snowflake DB",
      "type": "SNOWFLAKE",
      "url": "jdbc:snowflake://gooddata.snowflakecomputing.com?warehouse=GOODDATA_DEMO_WAREHOUSE&db=GOODDATA_DEMO_DATABASE",
      "schema": "ECOMMERCE_DEMO_SCHEMA",
      "username": "gooddata_demo"
    }
  },
  "links": {
    "self": "$HOST_URL/api/v1/entities/dataSources/demo-ds"
  }
}

About the Sample Database

The data represent a simple scenario of an e-commerce system that tracks customers, how they order certain products, and how much money was spent on various marketing campaigns in different campaign channels.

The data are stored and organized according to the following physical schema of tables and their relationships:

Sample data structure