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.0.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.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cozycosmos-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 ad5b632f5eba8277beb83d9d3cdfe57a7b3dc0fd2b383a7259b159c3fb04e447
MD5 54b9ad079608872c365871cce58a2719
BLAKE2b-256 808b73543d0ea310fdcd2b95b0842ed35b338b1b978f3a7cd8c5344c4df815c2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cozycosmos-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5780455b8d439cd0335c1c011498f6d1febe0d8bcc9ae734005e3319881136c3
MD5 32c5443e07034effc1c57428adb71efc
BLAKE2b-256 59c0cfe84ba5262f93a05204dc71be95c4f79a9356f771072cb12aa9985b5bc2

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