asbestos
An easy way to mock Snowflake connections in Python!
What is this?
asbestos is a library for Python 3.9+ to allow easy mocking of Snowflake calls during local development or testing to save on costs and time. The docs have more information, but here's a quick example:
from asbestos import asbestos_cursor, config as asbestos_config
def snowflake_cursor() -> SnowflakeCursor | AsbestosCursor:
# Use a flag to decide whether it returns the test cursor
# or the real thing
if settings.ENABLE_ASBESTOS:
return asbestos_cursor()
return snowflake_connection().cursor(DictCursor)
asbestos_config.register(
query="your sql goes %s",
data=("here",),
response={"It's a": "response!"}
)
with snowflake_cursor() as cursor:
cursor.execute("your sql goes %s", ('here',))
assert cursor.fetchall() == {"It's a": "response!"}
asbestos is not a 1:1 mocking of the full Snowflake API, but includes synchronous and async query mocking that handle most use cases. Check out some fun things you can do with it here!
Installation:
poetry add asbestos
Docs
Check out the documentation here!
To work on the docs locally, ensure that your python3 version is up-to-date (pyenv is a great way of managing this) and run make docs. This will create a dedicated documentation environment and serve the docs locally for testing. To remove the environment, run make docs_clean.
Development
asbestos uses pre-commit to help us keep the repo clean. To get started, make sure you have poetry installed and follow these steps:
- clone the respository:
git clone git@github.com:SpotOnInc/asbestos.git(preferred)- OR
git clone https://github.com/SpotOnInc/asbestos
poetry installpoetry shellpre-commit install
After that, you're ready to go!
Metadata
Release files for asbestos 1.6.1
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 | |
|---|---|---|---|---|
| asbestos-1.6.1.tar.gz | 8.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| asbestos-1.6.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / asbestos-1.6.1.tar.gz
| Download URL | asbestos-1.6.1.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d9a34445eb86c3049f93c481131f3e3525d4b900cbdf0839c239e0d192d713f
|
|
BLAKE2b-256 checksum How to use checksums |
b98e7ea4ffdfd4e858d59a2fc0d6f5625e381dc5ba0f9a0afe346da49fc3fdb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-1021-azure
|
Release files / asbestos-1.6.1-py3-none-any.whl
| Download URL | asbestos-1.6.1-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c48a4977ffbf2df704ec748d2598ed7613122baeeca2bda23e8fef36e3abbd19
|
|
BLAKE2b-256 checksum How to use checksums |
d460436da77c16e44796af50de0cbd0b4d2170527695ee37f13ef40c74d3d224
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/6.8.0-1021-azure
|
Security for asbestos 1.6.1
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.