Camus
Camus is a raw SQL library enabling an ease integration with the new Aurora Serverless Data API. Its API is based on the powerful Records library.
Instalation
The recommended installation method is pipenv:
$ pipenv install camus
Basic Usage
First you need to have an Aurora cluster ARN and a Secret ARN. If don't have one yet, just follow the Data API Getting Started Guide.
With that in hands, let's drop some query in our database:
import camus
db = camus.Database(
resource_arn="arn:aws:rds:us-east-1:123456789012:cluster:your-cluster-name",
secret_arn="arn:aws:secretsmanager:us-east-1:123456789012:secret:your-secret-name-ByH87J",
dbname="mydb",
)
rows = db.query("SELECT * FROM users")
You can grab one row at time (like in Records library)
>>> rows[0]
<camus.Record at 0x109bfbd30>
Or iterate over them:
for r in rows:
print(r.name, r.email)
Like mentioned before, Camus tries to maintain the same API of the Records library, so you have the same access patterns:
row.email
row['email']
row[3]
Other options include rows.as_dict() and rows.as_dict(ordered=True)
Transactions
Data API transactions are supported by Camus:
with db.transaction() as txid:
db.query("INSERT INTO users (name, email) VALUES (:name, :email)", name="Rafael", email="rafael@email.com")
db.query("UPDATE posts SET title = :title WHERE id = :id", title="New Title", id=999)
If any exception is raised when executing any of the queries, a rollback is performed automatically.
That's all folks
Thanks for the awesome @kennethreitz for providing his knowledge on the excelent Records library and all the talks he has given over the years!
Metadata
Release files for camus 1.0.0
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 |
|---|---|---|---|---|
| camus-1.0.0.tar.gz | 5.1 kB | Without provenance | Details for camus-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| camus-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for camus-1.0.0-py3-none-any.whl |
Total release size: 10.9 kB
Release files / camus-1.0.0.tar.gz
| Download URL | camus-1.0.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb7aa05bc3514738f08e950feb13b9ae3de437df4e8232d5871fd55ed12ab12c
|
|
BLAKE2b-256 checksum How to use checksums |
4003860956667956c557ab253243823acff8b7a19f9e292c3968d60b34a01ba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
|
Release files / camus-1.0.0-py3-none-any.whl
| Download URL | camus-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
69e7d60c9afc2b09a515132290b0987555fc43b103af8b1452ce2512d9511d12
|
|
BLAKE2b-256 checksum How to use checksums |
2eb509e25ad72ee300963d9c1e7c16bbfd1fb680c3cfc9e2102247e1de9b551b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.1
|
Security for camus 1.0.0
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.