This project joins some useful scripts designed to speed up project development.
Main scripts are:
configuration.py
This script generates a configparser.configuration instance.
Configuration load from different sources:
AWS Systems manager parameter store
- Given that AWS CLI is configured and credentials loaded
configuration = load_config('ssm',environment)
SSM variable key must have format: /$environment/$section and value in json format
| Key | Value |
|---|---|
| /pre/ddbb | {"host":"localhost","port":3306,"username":"root","password":"changeit"} |
Local file
configuration = load_config('file',environment, file_name)
File expected in standard INI file structure.
[ddbb]
host=localhost
port=3306
username=root
password=changeit
Environment variables.
configuration = load_config('env',environment, projectname)
Variables should have the following format: $projectname_$environemnt_$sectionname
MYPROJECT_PRO_DDBB_HOST=localhost
MYPROJECT_PRO_DDBB_PORT=3306
MYPROJECT_PRO_DDBB_USERNAME=root
MYPROJECT_PRO_DDBB_PASSWORD=changeit
Database.py
Database connection and query execution
database = Database.ofConfiguration(configuration)
To execute query, use method Database.run_query
records = database.run_query('SELECT * FROM table WHERE mycolumn = %s AND myothercolumn = '%s',('value1', 'value2' ))
Pagination is supported using class database.Page:
page_number = 1
page_size = 50
page = Database.Page(page_number, page_size)
records = database.run_query('SELECT * FROM table WHERE mycolumn = %s AND myothercolumn = '%s', ('value1', 'value2' ), page)
alerts.py
Alert sending, via AWS simple email service.
Release files for basacommons 0.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| basacommons-0.0.16.tar.gz | 4.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| basacommons-0.0.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / basacommons-0.0.16.tar.gz
| Download URL | basacommons-0.0.16.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a820ced896cdbbbc765d5fed77205e99d531545090841aa22237be14fcd23e2
|
|
BLAKE2b-256 checksum How to use checksums |
4c190c96b65f6584e872c97f4be0ddc0578a6dbcfd3e43696ac7933a7dfe3bb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5
|
Release files / basacommons-0.0.16-py3-none-any.whl
| Download URL | basacommons-0.0.16-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff842574f859a3aa96c2b4d952b65918e626b948698164c2fc1da1e1f4f06abd
|
|
BLAKE2b-256 checksum How to use checksums |
206d1f82456581e9f3eb38c179e8630f4ff8aca3856f076576583285b3b75a9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/50.0.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.5
|