Skip to main content

DOMETL (Python ETL Tool)

Dometl is a Python ETL package.

Process

  1. Init - Initializes the database
dometl -t init
  1. Stage - Moves files into staging tables
dometl -t stage
  1. Live - Runs transformations to move data from staging to live tables
dometl -t live
  1. Test - Runs very simple tests on the data
dometl -t test

How to Install & Run the Package?

Run the initialization step

dometl -t init -cp dometl_config
# if you don't install the package
# python -c "from dometl import run_dometl; run_dometl()" -t init -cp dometl_config

Run the staging step

dometl -t stage -ep datasets\\game_data\\daily\\20221105_g.csv -tb ST_GAME -cp dometl_config
# if you don't install the package
# python -c "from dometl import run_dometl; run_dometl()" -t stage -ep datasets\\game_data\\daily\\20221105_g.csv -tb st_game -cp dometl_config
# python -c "from dometl import run_dometl; run_dometl()" -t stage -ep datasets\\game_data\\seasons -tb st_game -cp dometl_config

Run the live step

dometl -t live -tb game -cp dometl_config
# if you don't install the package
# python -c "from dometl import run_dometl; run_dometl()" -t live -tb game -cp dometl_config

Run the test step

dometl -t test -tb game -cp dometl_config
# if you don't install the package
# python -c "from dometl import run_dometl; run_dometl()" -t test -tb game -cp dometl_config

The simple testing is made up of testing queries which are placed into the config.yaml folder like below

tests:
  table_name: ["some_test.sql", "other_test.sql"]

Each table can have a set of test queries. The queries need to be written in a way that they return 0 rows when the test passes. If the query returns more than 0 rows the test will fail. As a suggestion the rows that are returned should help find the root cause of the failure.

Configuration Folder

\folder
    config.yaml     # structure defined below
    db_create.sql   # custom file which creates and initializes the db
    file1.sql       # custom SQL file
    file2.sql       # custom SQL file
    file3.sql       # custom SQL file
    file4.sql       # custom SQL file
    file5.sql       # custom SQL file

Structure for config.yaml

credentials_path: "path/to/creds.yaml"

init_order: [
  "db_create.sql",
  "file1.sql",
  "file2.sql",
]

etl:
  table_name_1: "file3.sql"  
  table_name_2: "file4.sql"  
  table_name_3: "file5.sql"  

Structure for the creds.yaml

db_credentials:
  username: ""
  password: ""
  hostname: ""
  port: ""
  db_name: ""

Bonus

Run a script with psql

psql -U postgres -h 127.0.0.1 -d DBNAME -f path\path\file_name.sql

Copy CSV into a table

psql -U postgres -h 127.0.0.1 -d DBNAME -c "COPY table_name FROM '/'some_name.csv' WITH (FORMAT csv)"

Metadata

Release files for dometl 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dometl 0.0.1
File Size Uploaded
dometl-0.0.1.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dometl 0.0.1
File Interpreter ABI Platform
dometl-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.0 kB

Release files / dometl-0.0.1.tar.gz

Download URL dometl-0.0.1.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4ab406e5e46a53a2b93890bb9252e810093663ba070ad237a13172582ae4dbc5
BLAKE2b-256 checksum
How to use checksums
e0ee8bae49a6d479626364e90ebb9e54207d38593bbaf60401b5bb549581fc70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release files / dometl-0.0.1-py3-none-any.whl

Download URL dometl-0.0.1-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5254b02ef484d9bd4072348b93c0c14091128e16753298b497510a92dc809d05
BLAKE2b-256 checksum
How to use checksums
4892002c5b8dcdd78818d4076effa622042cebf84dcbf514982db461cda35f09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page