diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff672ad..903b8d28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 [Please read through the Keep a Changelog (~5min)](https://keepachangelog.com/en/1.0.0/). +## [0.8.13] - 2023-05-10 + +### Fixed + +- Issue with passing `named_parameters` for an asset-based run in Jobs API 2.1 via CLI in `dbx launch` +- Arguments used in docs for asset-based launch + ## [0.8.12] - 2023-05-06 -## Fixed +### Fixed - Explicitly pin the `requests` version to avoid issues with downstream libraries diff --git a/dbx/__init__.py b/dbx/__init__.py index cb4382b8..07508a60 100644 --- a/dbx/__init__.py +++ b/dbx/__init__.py @@ -1 +1 @@ -__version__ = "0.8.12" +__version__ = "0.8.13" diff --git a/dbx/models/workflow/v2dot1/_parameters.py b/dbx/models/workflow/v2dot1/_parameters.py index dec6f563..c2dc31b3 100644 --- a/dbx/models/workflow/v2dot1/_parameters.py +++ b/dbx/models/workflow/v2dot1/_parameters.py @@ -8,6 +8,7 @@ StringArray, BaseParametersMixin, PipelineTaskParametersPayload, + NamedParametersMixin, ) @@ -15,5 +16,5 @@ class FlexibleParametersMixin(ParametersMixin): parameters: Optional[Union[ParamPair, StringArray]] -class PayloadElement(FlexibleParametersMixin, BaseParametersMixin, PipelineTaskParametersPayload): +class PayloadElement(FlexibleParametersMixin, BaseParametersMixin, PipelineTaskParametersPayload, NamedParametersMixin): task_key: str diff --git a/docs/guides/general/passing_parameters.md b/docs/guides/general/passing_parameters.md index dd77c7af..66af06e3 100644 --- a/docs/guides/general/passing_parameters.md +++ b/docs/guides/general/passing_parameters.md @@ -70,8 +70,8 @@ All parameters should be provided in a form of a JSON-compatible payload (see ex Examples for Jobs API 2.0: ```bash - dbx launch --assets-only --parameters='{"base_parameters": {"key1": "value1", "key2": "value2"}}' # for notebook_task - dbx launch --assets-only --parameters='{"parameters": ["argument1", "argument2"]}' # for spark_jar_task, spark_python_task and spark_submit_task + dbx launch --from-assets --parameters='{"base_parameters": {"key1": "value1", "key2": "value2"}}' # for notebook_task + dbx launch --from-assets --parameters='{"parameters": ["argument1", "argument2"]}' # for spark_jar_task, spark_python_task and spark_submit_task ``` For Jobs API 2.1, the payload format should be compliant with the [JobsRunSubmit](https://docs.databricks.com/dev-tools/api/latest/jobs.html#operation/JobsRunsSubmit). @@ -81,27 +81,27 @@ All parameters should be provided in a form of a JSON-compatible payload (see ex ```bash # notebook_task - dbx launch --assets-only --parameters='[ + dbx launch --from-assets --parameters='[ {"task_key": "some", "base_parameters": {"a": 1, "b": 2}} ]' # spark_python_task, python_wheel_task, spark_jar_task, spark_submit_task, python_wheel_task - dbx launch --assets-only --parameters='[ + dbx launch --from-assets --parameters='[ {"task_key": "some", "parameters": ["a", "b"]} ]' # python_wheel_task - dbx launch --assets-only --parameters='[ + dbx launch --from-assets --parameters='[ {"task_key": "some", "named_parameters": {"a": 1, "b": 2}} ]' # pipeline_task - dbx launch --assets-only --parameters='[ + dbx launch --from-assets --parameters='[ {"task_key": "some", "full_refresh": true} ]' # sql_task - dbx launch --assets-only --parameters='[ + dbx launch --from-assets --parameters='[ {"task_key": "some", "parameters": {"key1": "value2"}} ]' ``` diff --git a/tests/unit/models/test_parameters.py b/tests/unit/models/test_parameters.py index e14cbc61..2252feac 100644 --- a/tests/unit/models/test_parameters.py +++ b/tests/unit/models/test_parameters.py @@ -66,3 +66,11 @@ def test_assert_based_v2dot0_not_unique(): def test_assert_based_v2dot1_good(param_raw_payload): parsed = V2dot1AssetBasedRunPayload.from_string(param_raw_payload) assert parsed.elements is not None + + +def test_asset_based_v2dot1_sample(): + payload = """[ + {"task_key": "main", "named_parameters": {"a": 1, "b": 2}} + ]""" + parsed = V2dot1AssetBasedRunPayload.from_string(payload) + assert parsed.elements[0].named_parameters == {"a": 1, "b": 2}