Skip to main content

A small convenience wrapper for Azure Cosmos DB CRUD operations.

Project description

cozycosmos

A small convenience wrapper for Azure Cosmos DB CRUD operations.

Installation

pip install cozycosmos

For local development from this repository:

python -m pip install -e .

Usage

Set your Cosmos DB credentials:

export COSMOS_URL="https://your-account.documents.azure.com:443/"
export COSMOS_KEY="your-cosmos-key"

Use the package:

from cozycosmos import CosmosStore

store = CosmosStore(
    database_name="prototype-db",
    container_name="documents",
    partition_key_path="/partitionKey",
)

item = store.write(
    {
        "id": "1",
        "partitionKey": "default",
        "name": "name1",
        "city": "Christchurch",
    }
)

print(item)

Command Line

After installing the package, use the cozycosmos command:

ezcosmos \
  --database prototype-db \
  --container documents \
  read 1

You can also pass credentials directly instead of using COSMOS_URL and COSMOS_KEY:

ezcosmos \
  --url "https://your-account.documents.azure.com:443/" \
  --key "your-cosmos-key" \
  --database prototype-db \
  --container documents \
  write '{"id": "1", "partitionKey": "default", "name": "name1"}'

You can also run the sample in examples/basic_usage.py:

python examples/basic_usage.py

Build

Install build tooling:

python -m pip install build twine

Build the package:

python -m build

Check the package metadata:

python -m twine check dist/*

Upload to TestPyPI:

python -m twine upload --repository testpypi dist/*

Upload to PyPI:

python -m twine upload dist/*

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

cozycosmos-0.1.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cozycosmos-0.1.1-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file cozycosmos-0.1.1.tar.gz.

File metadata

  • Download URL: cozycosmos-0.1.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for cozycosmos-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d062624631730f9fa420668b4f0f53c790a945f882bb649a24b11fa24f81ecc9
MD5 b3844bc9060dc404a87daeec6f8cf556
BLAKE2b-256 e0476fd80ef89972bc2bf5862e59381d5c1baed2571b4b6644ffea373457790f

See more details on using hashes here.

File details

Details for the file cozycosmos-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cozycosmos-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for cozycosmos-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 17f7b803de3ce65d833e033508c267f6fd3a17122142c6c3e7b1fd435cf3b034
MD5 fb205415c3503165024fab788b06dd8b
BLAKE2b-256 3ccd6e5bd8ac207dd039b2c062fbb3674b8406471ba293b4e5ae0c222fb081f1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page