cosmos-bulk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ MIT License
2
+ Copyright (c) 2026 Surender Elangovan, Krishnakumar S
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmos-bulk
3
+ Version: 0.1.0
4
+ Summary: Azure Cosmos DB bulk delete utility
5
+ Author: Krishnakumar S
6
+ Author-email: Surender Elangovan <esurender99@gmail.com>
7
+ License: MIT
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: azure-cosmos>=4.5.0
12
+ Dynamic: license-file
13
+
14
+ # cosmos-bulk
@@ -0,0 +1 @@
1
+ # cosmos-bulk
@@ -0,0 +1,15 @@
1
+
2
+ [build-system]
3
+ requires=["setuptools>=68","wheel"]
4
+ build-backend="setuptools.build_meta"
5
+ [project]
6
+ name="cosmos-bulk"
7
+ version="0.1.0"
8
+ description="Azure Cosmos DB bulk delete utility"
9
+ readme="README.md"
10
+ requires-python=">=3.10"
11
+ license={text="MIT"}
12
+ authors=[{name="Surender Elangovan",email="esurender99@gmail.com"},{name="Krishnakumar S"}]
13
+ dependencies=["azure-cosmos>=4.5.0"]
14
+ [tool.setuptools.packages.find]
15
+ where=["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,2 @@
1
+ from .bulk import CosmosBulk
2
+ __version__='0.1.0'
@@ -0,0 +1,26 @@
1
+
2
+ import asyncio
3
+ from azure.cosmos.aio import CosmosClient
4
+ class CosmosBulk:
5
+ def __init__(self,endpoint,key,database,container):
6
+ self.endpoint=endpoint; self.key=key; self.database=database; self.container=container
7
+ def delete(self,query,partition_key_field,concurrency=10):
8
+ return asyncio.run(self._delete(query,partition_key_field,concurrency))
9
+ async def _delete(self,query,partition_key_field,concurrency):
10
+ client=CosmosClient(self.endpoint,credential=self.key,enable_bulk=True)
11
+ try:
12
+ c=client.get_database_client(self.database).get_container_client(self.container)
13
+ sem=asyncio.Semaphore(concurrency); deleted=0
14
+ async def w(doc):
15
+ nonlocal deleted
16
+ async with sem:
17
+ await c.delete_item(item=doc["id"],partition_key=doc[partition_key_field]); deleted+=1
18
+ tasks=[]
19
+ async for d in c.query_items(query=query):
20
+ if "id" not in d: raise ValueError("Query must return id")
21
+ if partition_key_field not in d: raise ValueError("Missing partition key field")
22
+ tasks.append(asyncio.create_task(w(d)))
23
+ if tasks: await asyncio.gather(*tasks)
24
+ return {"deleted":deleted,"failed":0}
25
+ finally:
26
+ await client.close()
@@ -0,0 +1,14 @@
1
+ Metadata-Version: 2.4
2
+ Name: cosmos-bulk
3
+ Version: 0.1.0
4
+ Summary: Azure Cosmos DB bulk delete utility
5
+ Author: Krishnakumar S
6
+ Author-email: Surender Elangovan <esurender99@gmail.com>
7
+ License: MIT
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: azure-cosmos>=4.5.0
12
+ Dynamic: license-file
13
+
14
+ # cosmos-bulk
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/cosmos_bulk/__init__.py
5
+ src/cosmos_bulk/bulk.py
6
+ src/cosmos_bulk.egg-info/PKG-INFO
7
+ src/cosmos_bulk.egg-info/SOURCES.txt
8
+ src/cosmos_bulk.egg-info/dependency_links.txt
9
+ src/cosmos_bulk.egg-info/requires.txt
10
+ src/cosmos_bulk.egg-info/top_level.txt
11
+ tests/test_bulk.py
@@ -0,0 +1 @@
1
+ azure-cosmos>=4.5.0
@@ -0,0 +1 @@
1
+ cosmos_bulk
@@ -0,0 +1,3 @@
1
+ def test_import():
2
+ from cosmos_bulk import CosmosBulk
3
+ assert CosmosBulk