Habilidades Azure Cosmos DB SDK for Python
📦

Azure Cosmos DB SDK for Python

Seguro 🌐 Acceso a red🔑 Variables de entorno

Build Cosmos DB applications with Python SDK

Working with globally distributed databases requires understanding partition keys and efficient queries. This skill provides production-ready patterns for Azure Cosmos DB operations using the official Python SDK.

Soporta: Claude Codex Code(CC)
🥉 73 Bronce
1

Descargar el ZIP de la skill

2

Subir en Claude

Ve a Configuración → Capacidades → Skills → Subir skill

3

Activa y empieza a usar

Pruébalo

Usando "Azure Cosmos DB SDK for Python". Query items where price is less than 500 in the electronics partition

Resultado esperado:

Returns a list of product documents matching the price filter, sorted by partition key for efficient single-partition retrieval with minimal request unit consumption.

Usando "Azure Cosmos DB SDK for Python". Upsert a new product item with id, category, name, and price fields

Resultado esperado:

Creates the item if it does not exist or replaces it if it exists, returning the created or updated document with system-generated metadata like _ts and _rid.

Auditoría de seguridad

Seguro
v1 • 2/24/2026

This is a prompt-only skill containing documentation and code examples for Azure Cosmos DB SDK. Static analysis found 0 security issues with a risk score of 0/100. The skill provides legitimate database operation patterns using official Azure SDK libraries. Network and environment access patterns shown are standard Azure authentication flows requiring user-provided credentials.

0
Archivos escaneados
0
Líneas analizadas
2
hallazgos
1
Auditorías totales

Factores de riesgo

🌐 Acceso a red
No se registraron ubicaciones específicas
🔑 Variables de entorno
No se registraron ubicaciones específicas
Auditado por: claude

Puntuación de calidad

38
Arquitectura
100
Mantenibilidad
87
Contenido
50
Comunidad
100
Seguridad
83
Cumplimiento de la especificación

Lo que puedes crear

E-commerce Product Catalog

Build a globally distributed product catalog with partition key optimization for fast lookups by category and efficient range queries for price filtering.

IoT Telemetry Storage

Store and query time-series sensor data using hierarchical partition keys for tenant and device isolation with automatic global replication.

User Session Management

Implement low-latency session storage with automatic failover across Azure regions using Cosmos DB consistency levels and TTL policies.

Prueba estos prompts

Basic CRUD Operations
Create a Python script that connects to Azure Cosmos DB and performs create, read, update, and delete operations on a container storing user profiles with partition key /user_id.
Parameterized Query with Filtering
Write a query function that retrieves products under a maximum price within a specific category partition using parameterized SQL to prevent injection and improve caching.
Async High-Throughput Batch Insert
Implement an async Python function that batches and inserts 1000 items into Cosmos DB using the async client with proper error handling and retry logic for rate limiting.
Container Provisioning with Partition Strategy
Generate a setup script that creates a Cosmos DB container with hierarchical partition keys, provisioned throughput of 5000 RU/s, and appropriate indexing policies for a multi-tenant event logging system.

Mejores prácticas

  • Always specify partition key for point reads and queries to minimize latency and cost
  • Use parameterized queries instead of string concatenation to prevent injection attacks
  • Design partition keys for even data distribution to avoid hot partitions

Evitar

  • Performing cross-partition queries without enable_cross_partition_query flag
  • Using read_all_items without partition key filtering in production workloads
  • Creating containers without planning partition key strategy upfront

Preguntas frecuentes

What is the minimum throughput for a Cosmos DB container?
The minimum provisioned throughput is 400 RU/s for a single partition. Serverless mode is also available for unpredictable workloads.
How do I handle 429 rate limiting errors?
Catch CosmosHttpResponseError with status code 429 and retry after the duration specified in the x-ms-retry-after-ms header.
Can I change the partition key after container creation?
No, partition keys are immutable. You must migrate data to a new container if you need to change the partition strategy.
What authentication methods does the SDK support?
The SDK supports connection string authentication and Azure Identity-based authentication using DefaultAzureCredential for managed identities.
How do I enable async operations in the SDK?
Import CosmosClient from azure.cosmos.aio and use async context managers with await for all database operations.
What consistency levels are available in Cosmos DB?
Cosmos DB offers five levels: strong, bounded staleness, session, consistent prefix, and eventual, trading off latency and consistency.

Detalles del desarrollador

Estructura de archivos

📄 SKILL.md