From 5aec20067e1bc232621578989ffedcf56c0b7440 Mon Sep 17 00:00:00 2001 From: Sean Bryan Date: Wed, 27 May 2026 14:25:39 -0400 Subject: [PATCH] Add `--by-name` option to `meorg output query` The `/modeloutput` get endpoint requires specifying the `name` key when querying by name and meorg_client is currently fixed to query by id. This change adds a `--by-name` argument to `meorg output query` which will force the command to query the model output by name rather than by its id. --- meorg_client/cli.py | 8 +++++--- meorg_client/client.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/meorg_client/cli.py b/meorg_client/cli.py index 86b9d0e..7055cbb 100644 --- a/meorg_client/cli.py +++ b/meorg_client/cli.py @@ -325,8 +325,9 @@ def create_new_model_output( @click.command("query") +@click.option("--by-name", is_flag=True, default=False, help="Query by name instead of ID.") @click.argument("model_id") -def model_output_query(model_id: str): +def model_output_query(model_id: str, by_name: bool): """ Get details for a specific new model output entity @@ -334,13 +335,14 @@ def model_output_query(model_id: str): ---------- model_id : str Model Output ID. - + by_name : bool + Whether to query by name instead of ID. Prints the `id` modeloutput, and JSON representation for the remaining metadata if in dev mode. """ client = _get_client() - response = _call(client.model_output_query, model_id=model_id) + response = _call(client.model_output_query, model_id=model_id, by_name=by_name) if client.success(): diff --git a/meorg_client/client.py b/meorg_client/client.py index 05e2ef4..da098a4 100644 --- a/meorg_client/client.py +++ b/meorg_client/client.py @@ -479,7 +479,7 @@ def model_output_create( json=dict(model=mod_prof_id, name=name) | config_params, ) - def model_output_query(self, model_id: str) -> Union[dict, requests.Response]: + def model_output_query(self, model_id: str, by_name: bool = None) -> Union[dict, requests.Response]: """ Get details for a specific new model output entity Parameters @@ -495,7 +495,7 @@ def model_output_query(self, model_id: str) -> Union[dict, requests.Response]: return self._make_request( method=mcc.HTTP_GET, endpoint=endpoints.MODEL_OUTPUT_QUERY, - url_params=dict(id=model_id), + url_params=dict(name=model_id) if by_name else dict(id=model_id), ) def model_output_update(