# db-facts
db-facts translates from user-familiar database coordinates (e.g., “redshift”, “corppostgres dbadmin”, “productoracle impl juser”) into detailed instructions on how to access the database in question, providing configuration and templating mechnisms to wrap any credential management tools involved in providing those details and credentials.
Example:
`sh $ db-facts sh redshift export CONNECTION_TYPE CONNECTION_TYPE=direct export LASTPASS_SHARE_NAME_SUFFIX LASTPASS_SHARE_NAME_SUFFIX='blue labs redshift' export DB_PASSWORD DB_PASSWORD='hunter2' DB_HOST=whatevs.whatevs.us-east-1.redshift.amazonaws.com export DB_HOST export DB_DATABASE DB_DATABASE=analytics export DB_USERNAME DB_USERNAME=vbroz export DB_PORT DB_PORT=5439 export DB_TYPE DB_TYPE=redshift export DB_PROTOCOL DB_PROTOCOL=postgres `
To do this, it relies on a config file (“dbcli.yml”) which teaches it how to parse the user-friendly coordinates. Much of the heavy lifting in the parsing part is done by [jinja_context.py](https://github.com/bluelabsio/db-facts/blob/master/db_facts/jinja_context.py), which sets some variables and functions that can be used in jinja templates within the config file.
This is part of the suite of programs which allow a user to type in things like db redshift and connect via their own credentials to the configured database named ‘redshift’. Other parts of this chain can be found in the [ws-scripts](https://github.com/bluelabsio/ws-scripts) repo.
If you need to set the instructions immediately to your environment variables, you can do this with the command: `sh eval $(db-facts redshift) `
## Configuration
You can configure db-facts to connect to your databases. See [CONFIGURATION.md](./CONFIGURATION.md) for details.
## Extensions
You can extend db-facts to pull configuration from other systems. See [EXTENSIONS.md](./EXTENSIONS.md) for details.
## Library
To use as a library:
`sh $ python Python 3.5.2 (default, Sep 12 2016, 09:31:17) [GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import bluelabs_db_facts >>> db_facts.db(['redshift']) {'protocol': 'postgres', 'lastpass_share_name_suffix': 'blue labs redshift', 'host': 'bl-int-analytics1.cxtyzogmmhiv.us-east-1.redshift.amazonaws.com', 'connection_type': 'direct', 'user': 'vbroz', 'database': 'analytics', 'password': 'hunter1', 'port': 5439, 'type': 'redshift'} >>> `
## Development
See [DEVELOPMENT.md](./DEVELOPMENT.md)
Metadata
Release files for db-facts 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| db_facts-3.0.2.tar.gz | 15.5 kB | Without provenance | Details for db_facts-3.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| db_facts-3.0.2-py3-none-any.whl | Python 3 | none | any | Details for db_facts-3.0.2-py3-none-any.whl |
Total release size: 43.5 kB
Release files / db_facts-3.0.2.tar.gz
| Download URL | db_facts-3.0.2.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd4858078e5af075a79ddaa4d3e6d88a01b4b733199498684eb3c0e7790403f4
|
|
BLAKE2b-256 checksum How to use checksums |
074c4f629fd9926a85c2a8d5172bb5af84cdaf79dce1924699285ba582959768
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10
|
Release files / db_facts-3.0.2-py3-none-any.whl
| Download URL | db_facts-3.0.2-py3-none-any.whl |
|---|---|
| Size | 28.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7c3e7f69d7a42860c1a150d3d34e5acd3201d4bcbfc816b1c1c324357749055c
|
|
BLAKE2b-256 checksum How to use checksums |
9bcdb080a434b2b74119cfbad06253ac0fba57a271feb9c71ef76b294b0e6261
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.10
|
Security for db-facts 3.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.