No project description provided
Project description
Getting started with HAMB
Local setup
It is recommended to use the steps below to set up a virtual environment for development:
python3 -m venv <virtual env name>
source <virtual env name>/bin/activate
pip install -r requirements.txt
or
pip install hamb
Save credentials to etl.cfg file locally in project directory. See sample.etl.cfg file provided in root directory.
Directory Structure
By default, it will look for manifests folder, etl.cfg and services.yaml in your current working directory.
hamb/
manifests/
etl.cfg
services.yaml
Manifests
This is about metadata about your test sets, including the sql and diagnostic queries to be run. Manifests files are stored in /manifests
Services
services.yaml This is a global config which stores outbound communication details. Basically it says for a given scenerio, what handlers will be used, and with what targets.
Handlers
Test results are printed, but handlers are available for other means of notification. See /hamb/handlers/.
email_handler
sftp_handler
slack_handler
sql_compo_list
sql_comp
watch_file_handler
jenkins_handler
sns_handler
Execution walkthru
HAMB will be executed from command line for a given manifest (test set): hamb -m sample_compare
It will read the tests from the corresponding manifest file into a Python object
It will then loop through each test
For each test it will execute the appropriate plugin
The results from each test will be collected, then as configured in services.yaml the appropriate handler will be evoked
Based on the services metadata, the appropriate handler will be evoked with parameters for that service (email list, sns topic, etc)
Go ahead, compose your own and try it out..
Examples
Compare two lists wherein it succeeds when the lists are the same and fails when different.
Try running hamb -m sample_compare or python -m hamb.module -m sample_compare
Examples:
a. when lists are the same
'script_a_result': [a, b, c]
'script_b_result': [a, b, c]
'status': 'success'
'diff': None
b. when only a few elements are similar
'script_a_result': [a, b, c]
'script_b_result': [a, b]
'status': 'failure'
'diff': [c]
c. when one list is empty
'script_a_result': [a, b, c]
'script_b_result': []
'status': 'failure'
'diff': [a, b, c]
d. when lists have completely different elements
'script_a_result': [a, b, c]
'script_b_result': [d, e, f]
'status': 'failure'
'diff': [a, b, c, d, e, f]
If the manifest is in another folder, you can provide the absolute path
hamb -m /path/to/sample_compare
If you want to use AWS secrets, just include –config secret_manager param.
hamb -m sample_compare --config secret_manager
Hamb also supports logging the results to the database. To use this feature, include -t <your_database_table>. See: /hamb/ham_run_utility.py:save_db_log() method for sample table schema.
hamb -m sample_compare --t public.hambot_history
Tests
To run the testing suite, the following commands are required:
pip install -r requirements-dev.txt
tox
or
python -m unittest discover tests
Documentation
HAMB documentation is powered by Sphinx, a tool that makes documentation easy.
To build docs locally
cd docs
make html
To see HAMB documentation, open /docs/_build/html/index.html.
If you want to make changes, edit README.rst and build docs again.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file hamb-0.1.10.tar.gz
.
File metadata
- Download URL: hamb-0.1.10.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfa3b139f815fe01dad603db3b28b2f552a8f39d8438e3e5d2b792a2c301ec91 |
|
MD5 | 44556d4ebd1cb2e484002c80fc9cc849 |
|
BLAKE2b-256 | 605eb4f0d5d22491ce405f57d93880af47d3ed9458be63b3a3b3d3f3f99db352 |