diff --git a/splitgraph/cloud/__init__.py b/splitgraph/cloud/__init__.py index 4843c6d9..5ed128b4 100644 --- a/splitgraph/cloud/__init__.py +++ b/splitgraph/cloud/__init__.py @@ -197,7 +197,7 @@ def get_headers(): repository repoTopicsByNamespaceAndRepository { nodes { - topics + topic } } repoProfileByNamespaceAndRepository { @@ -756,19 +756,6 @@ def upsert_metadata(self, namespace: str, repository: str, metadata: Metadata): Update metadata for a single repository. """ response = self._gql(self._prepare_upsert_metadata_gql(namespace, repository, metadata)) - if ( - response.status_code == 400 - and 'Cannot query field \\"createRepoTopicsAgg\\" on type \\"Mutation\\"' - in response.text - ): - # TODO: hack, delete when all upgraded. - # We don't yet have API versioning on the GQL side and there's a breaking change - # coming that'll rename createRepoTopic to createRepoTopicsAgg. If there's - # an error calling the latter, rewrite the query to call the former instead. - logging.debug("Using old metadata replacement query") - response = self._gql( - self._prepare_upsert_metadata_gql(namespace, repository, metadata, v1=True) - ) return response def bulk_upsert_metadata( diff --git a/splitgraph/cloud/models.py b/splitgraph/cloud/models.py index b34a78ae..0fea09bc 100644 --- a/splitgraph/cloud/models.py +++ b/splitgraph/cloud/models.py @@ -83,7 +83,7 @@ class RepositoriesYAML(BaseModel): class MetadataResponse(BaseModel): class RepoTopicsResponse(BaseModel): class RepositoryTopics(BaseModel): - topics: List[str] + topic: str nodes: List[RepositoryTopics] @@ -116,9 +116,7 @@ def to_metadata(self) -> Metadata: return Metadata( readme=Metadata.Readme(text=profile.readme), description=profile.description, - topics=[ - t for node in self.repoTopicsByNamespaceAndRepository.nodes for t in node.topics - ], + topics=[node.topic for node in self.repoTopicsByNamespaceAndRepository.nodes], sources=profile.sources, license=profile.license, extra_metadata=profile.metadata.upstream_metadata if profile.metadata else None, diff --git a/test/splitgraph/commandline/http_fixtures.py b/test/splitgraph/commandline/http_fixtures.py index 7a4df032..068f82bf 100644 --- a/test/splitgraph/commandline/http_fixtures.py +++ b/test/splitgraph/commandline/http_fixtures.py @@ -170,7 +170,9 @@ def _gql_callback(request, uri, response_headers): _somerepo_2 = { "namespace": "otheruser", "repository": "somerepo_2", - "repoTopicsByNamespaceAndRepository": {"nodes": [{"topics": ["topic_1", "topic_2"]}]}, + "repoTopicsByNamespaceAndRepository": { + "nodes": [{"topic": "topic_1"}, {"topic": "topic_2"}] + }, "repoProfileByNamespaceAndRepository": { "description": "Repository Description 2", "license": None,