Skip to main content

A small convenience wrapper for Azure Cosmos DB CRUD operations.

Project description

ezcosmos

A small convenience wrapper for Azure Cosmos DB CRUD operations.

Installation

pip install ezcosmos

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 ezcosmos import CosmosStore

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

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

print(item)

Command Line

After installing the package, use the ezcosmos 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": "Junbum"}'

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

ezcosmos-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.

ezcosmos-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ezcosmos-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 ezcosmos-0.1.0.tar.gz
Algorithm Hash digest
SHA256 472245f941ce2a6305923b6413ee20e8340017fdfbb5b1f6e416e7caa4965928
MD5 707e62155c1077a78943acc2573c47e8
BLAKE2b-256 dd87ba7b80883da559a6712dd3c50c518232832aea8237885d44f278cc28a8c4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ezcosmos-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 ezcosmos-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 966b65bcf8e7eaea4b3603c00bfaef0fc7e146fbf03eb3a138e1cb17675659cc
MD5 81cf55a70f056532756b56eb6a92ef50
BLAKE2b-256 3ef93a9e5123ac15b8755b9ca986709aeeb4b1e04badd292109fd7386070bb6e

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