Skip to content

Mara3l/good-crm-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello and welcome to the Sales Analytics repository! 🚀🚀🚀

Load Analytics to Your GoodData Trial

If you want replicate the whole analytics from the article, you can easily do that by the following command. Before you run it, please do the steps described in the following sections:

👉 Setup virtual environment

👉 Install dependencies

👉 Environment Variables

$ python ./src/store_and_load_analytics.py load <workspace-id> 

Important note: You should create a workspace in GoodData Trial before you run the store_and_load_analytics.py script, see Create a Workspace.

Setup virtual environment

# Create virtual env
python -m virtualenv venv
# Activate virtual env
source venv/bin/activate
#You should see a `(venv)` appear at the beginning of your terminal prompt indicating that you are working inside the `virtualenv`.
# Deactivate virtual env once you are done
deactivate

Install dependencies

$ pip install -r requirements.txt

Environment Variables

Extract

If you want to replicate the Airtable Sales CRM from the article, visit this link and click Copy base. Once you have it, you can setup environment variables:

export EXTRACT_AIRTABLE_API_KEY='<AIRTABLE-API-KEY>'

You can create Airtable API KEY here.

export EXTRACT_AIRTABLE_BASE_ID='<AIRTABLE-BASE-ID>'

Example: export EXTRACT_AIRTABLE_BASE_ID='appZj5ydFeMfC8f7p'.

export EXTRACT_AIRTABLE_TABLES='["<AIRTABLE-TABLE>", "<AIRTABLE-TABLE>"]'

Example: export EXTRACT_AIRTABLE_TABLES='["tblwMVmNNV3HhJtww", "tblwIZrCQ0bJmFtBB", "tblvM4lMGVdBqAFLH"]'.

Important note: you should define EXTRACT_AIRTABLE_TABLES in the order you see it in the UI: deals, companies, contacts.

Load & Transform

If you do not have database, please create one on bit.io (or somewhere else) and setup the following environment variables:

export LOAD_DATABASE_HOST='<DATABASE_HOST>'
export LOAD_DATABASE_PORT='<DATABASE_PORT>'
export LOAD_DATABASE_USERNAME='<DATABASE_USERNAME>'
export LOAD_DATABASE_PASSWORD='<DATABASE_PASSWORD>'
export LOAD_DATABASE_NAME='<DATABASE_NAME>'
export LOAD_DATABASE_SCHEMA='input_stage'

Please use this exact variable; otherwise, it will not work.

export LOAD_DATABASE_SCHEMA='["airtable_crm_deals", "airtable_crm_companies", "airtable_crm_contacts"]'

Please use this exact variable; otherwise, it will not work.

Analytics

export ANALYTICS_GOODDATA_HOST='<GOODDATA_HOST>'

You can register here.

export ANALYTICS_GOODDATA_TOKEN='<GOODDATA_TOKEN>'

You can create GoodData token on the following URL: <your-gooddata-account>/settings.

export ANALYTICS_GOODDATA_DATASOURCE_ID='<GOODDATA_DATASOURCE_ID>'

You can connect a data source (in this case PostgreSQL from the previous step) on the following URL: <your-gooddata-account>/data-sources.

Troubleshooting

If you jumped into an issue, please feel free to report it. Also, you can write me on GoodData Community Slack.

Local Run

Run Extract & Load

$ python ./src/main.py

Run Transform

$ cd transform
$ dbt deps
$ dbt run
$ dbt test

Run Analytics

$ python ./src/extract_load.py

About

Analytics of CRM data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages