km2pg
Load raw kissmetrics data from specified s3 bucket into specified postgres database.
To install
In this directory, run the following command:
python setup.py install
To use
Once installed, a new script, named km2pg should now be available in PATH, which can be used as follows:
- km2pg
-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.
Requires
boto: Python library for AWS
psycopg: postgres Python client library
Comment
This script can safely be run from an Amazon spot instance, where checkpointing is important, since the script can be interrupted at any moment.
Strategy
kissmetrics deposits raw data into multiple json files:
- bucket/
- revisions/
1.json 2.json … N.json
kissmetrics provides an ‘index’ file at:
bucket/index.csv
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.
Release files for km2pg 0.2.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| km2pg-0.2.0.1.tar.gz | 7.9 kB | Details |
Release files / km2pg-0.2.0.1.tar.gz
| Download URL | km2pg-0.2.0.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0126dffba373fc682b1f508bba8dae09bd2a825af1cef610d94ce1917d6d967e
|
|
BLAKE2b-256 checksum How to use checksums |
ca339820289c3314dfb7620fc778f68d0399b016d42ddef3d1726b31ffefbef0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |