Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix query params issue dependent on bug in httpx<0.28 #1482

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions integration/test_tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,22 @@
from weaviate.exceptions import WeaviateInvalidInputError, WeaviateUnsupportedFeatureError


def test_shards_on_tenants(
client_factory: ClientFactory, collection_factory: CollectionFactory
) -> None:
collection = collection_factory(
vectorizer_config=Configure.Vectorizer.none(),
multi_tenancy_config=Configure.multi_tenancy(enabled=True),
)
collection.tenants.create(Tenant(name="tenant1"))
client = client_factory()

nodes = client.cluster.nodes(collection.name, output="verbose")
count = sum(len(node.shards) for node in nodes)

assert count == 1


@pytest.mark.parametrize("tenant", ["tenant1", Tenant(name="tenant1")])
def test_delete_by_id_tenant(
collection_factory: CollectionFactory, tenant: Union[str, Tenant]
Expand Down
8 changes: 6 additions & 2 deletions weaviate/collections/cluster/cluster.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from httpx import Response
from weaviate.connect import ConnectionV4


Expand Down Expand Up @@ -75,12 +76,15 @@ async def nodes(
If the response is empty.
"""
path = "/nodes"
params = None
if collection is not None:
path += "/" + _capitalize_first_letter(collection)
if output is not None:
path += f"?output={output}"
params = {"output": output}

response = await self._connection.get(path=path, error_msg="Get nodes status failed")
response: Response = await self._connection.get(
path=path, params=params, error_msg="Get nodes status failed"
)
response_typed = _decode_json_response_dict(response, "Nodes status")
assert response_typed is not None

Expand Down
2 changes: 1 addition & 1 deletion weaviate/connect/v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ async def get(
return await self.__send(
"GET",
url=self.url + self._api_version_path + path,
params=params if params is not None else {},
params=params,
rlmanrique marked this conversation as resolved.
Show resolved Hide resolved
error_msg=error_msg,
status_codes=status_codes,
)
Expand Down
Loading