Repository navigation
Add search() to the Python client - #3121
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
The Python client had no way to call the `GET /api/v1/search` endpoint, which the Java client already supports. Add `MarquezClient.search()` taking the query plus the optional `filter`, `sort`, `limit`, `namespace`, `before` and `after` parameters accepted by the endpoint, along with `SearchFilter` and `SearchSort` enums matching the server-side values. Unset optional parameters are not sent, so the server applies its defaults; `limit` defaults to `DEFAULT_LIMIT` like the other client methods. Closes: MarquezProject#3080 Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Python client can't call the search endpoint (
GET /api/v1/search), which the Java client already supports throughMarquezClient.search().Closes: #3080
Solution
MarquezClient.search(query, filter=None, sort=None, limit=None, namespace=None, before=None, after=None), covering every query parameter the endpoint accepts.SearchFilter(DATASET,JOB) andSearchSort(NAME,UPDATE_AT) enums tomarquez_client.models, matching the server values. They are checked withUtils.is_instance_of, the same waycreate_dataset()checksDatasetType.limitfalls back toDEFAULT_LIMIT, like the other client methods and the Java client.One-line summary: Client: Add
search()to the Python clientChecklist
CHANGELOG.md(Depending on the change, this may not be necessary)..sqldatabase schema migration according to Flyway's naming convention (if relevant)Testing
tests/test_marquez_client.pycover the default request, a request with every option set, and invalidquery,filter, andsortarguments.pytest tests/(40 passed) andflake8 marquez_client testspass.search()against a local Marquez API built frommainwith two jobs and three datasets ingested. The default,filter+sort,limit+namespace, andbefore/after(both a string and adatetime.date) calls all returned the expected results.