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.
Steps:
Go to Data sources and click Connect data.
Select the type of database you are using, we recommend connecting to our sample Snowflake database.
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.
- Account Name:
Fill in the schema name
ECOMMERCE_DEMO_SCHEMA
and click Save.The data source is created and appears in the list of data sources.
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: