Skip to content

Commit

Permalink
deprecate recreate_collection (#601)
Browse files Browse the repository at this point in the history
* add deprecation warning

* async client

* fmt

* fix: replace logging.warning with warnings.warn

* refactoring: update warning

---------

Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
  • Loading branch information
generall and joein committed Apr 22, 2024
1 parent 0ce5ca0 commit eee34e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions qdrant_client/async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1750,6 +1750,11 @@ async def recreate_collection(
Operation result
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`recreate_collection` method is deprecated and will be removed in the future. Use `collection_exists` to check collection existence and `create_collection` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.recreate_collection(
collection_name=collection_name,
vectors_config=vectors_config,
Expand Down
9 changes: 9 additions & 0 deletions qdrant_client/qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,8 @@ def create_collection(
**kwargs,
)

# WARN: This method is deprecated and will be removed in the future
# Use separate check for collection existence and `create_collection` instead
def recreate_collection(
self,
collection_name: str,
Expand Down Expand Up @@ -1812,6 +1814,13 @@ def recreate_collection(
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`recreate_collection` method is deprecated and will be removed in the future."
" Use `collection_exists` to check collection existence and `create_collection` instead.",
DeprecationWarning,
stacklevel=2,
)

return self._client.recreate_collection(
collection_name=collection_name,
vectors_config=vectors_config,
Expand Down

0 comments on commit eee34e8

Please sign in to comment.