Python Boilerplate contains all the boilerplate you need to create a Python package.
Project description
steampipe-alchemy
A simple SQLAlchemy wrapper around Steampipe.
Currently this is a work in progress. Models exist for the AWS plugin, others will be added in the future.
Free software: BSD license
Documentation: [WIP] https://steampipe-alchemy.readthedocs.io.
Features
Install, setup, and start steampipe with the aws plugin.
# We're assuming the the AWS credentials are set in the environment here.
from steampipe_alchemy as sa
sa.install(['aws']) # Downloads and installs steampipe with the aws plugin.
sa.update_config(aws={ # Modifies ~/.local/share/steampipe_alchemy/config/aws.spc
"plugin": "aws",
"regions": ['us-east-1', 'us-west-1', 'us-west-2']
})
sa.start() # Steampipe will be stopped when the script exits or when stop() is called.
We can then use the SQLAlchemy models to query AWS.
from steampipe_alchemy import query
from steampipe_alchemy.models import AwsS3Bucket
for b in query(AwsS3Bucket).limit(3):
print(b.name)
print(" Region: " + b.region)
print(" Owner: " + str(b.acl['Owner']['DisplayName']))
Which will produce something like:
example-bucket-1234
Region: us-east-1
Owner: example-prod-account
example-bucket-2345
Region: us-west-1
Owner: example-prod-account
example-bucket-3456
Region: us-west-2
Owner: example-prod-account
The function steampipe_alchemy.query is a small wrapper around sqlalchemy.orm.Query. It is setup to use the steampipe sqlalchemy session and has type annotations which enable IDE completion on both the Model results and the Query class.
Models are located in steampipe_alchemy.models and are automatically generated with ./scripts/generate_models.py.
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2021-04-15)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file steampipe_alchemy-0.1.6.tar.gz
.
File metadata
- Download URL: steampipe_alchemy-0.1.6.tar.gz
- Upload date:
- Size: 120.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9c45013b126a61ffbd38a6e5bfb59fd4ba77252350100508c7f610e1537f17b3 |
|
MD5 | e42c9117d5bc007163e7a374cc57a6be |
|
BLAKE2b-256 | c46b168eaf2635f06acef3b09ea89acfed039404153a385fba98082d6c0cc8cb |
File details
Details for the file steampipe_alchemy-0.1.6-py2.py3-none-any.whl
.
File metadata
- Download URL: steampipe_alchemy-0.1.6-py2.py3-none-any.whl
- Upload date:
- Size: 104.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1778f47c98328cd8b000796f29e3f7bc63558d744066041c5f62ad827203789a |
|
MD5 | 8081f3125e16a84e5c2a0ff4e6e8f908 |
|
BLAKE2b-256 | 3fa8b3a5fefc276c3804c993d411c4c115d43c0b8bbe6c348ebe896f79925549 |