Load kissmetrics website analytics data from an s3 bucket into a postgres database
Load raw kissmetrics data from specified s3 bucket into specified postgres database.
In this directory, run the following command:
python setup.py install
Once installed, a new script, named km2pg should now be available in PATH, which can be used as follows:
- -b name_of_s3_bucket -m postgres_hostname -p postgres_port -d postgres_dbname -u postgres_username -w postgres_passwd -a aws_access_key -s aws_secret_key
For more details, see km2pg –help.
- boto: Python library for AWS
- psycopg: postgres Python client library
kissmetrics deposits raw data into multiple json files:
- 1.json 2.json … N.json
kissmetrics provides an ‘index’ file at:
This index file lists all the json files that kissmetrics has currently deposited in the ‘revisions’ folder above.
Our strategy is to process the json files in the order they appear in index.csv (which happens to be in order of increasing time).
In our postgres instance, we will maintain our progress through index.csv. This approach assumes that kissmetrics only ever appends to index.csv, and never edits.