Skip to content

Commit

Permalink
Merge pull request #41 from dataiku/bug/sc-163656-fix-add-an-error-co…
Browse files Browse the repository at this point in the history
…lumn-mode

fix: [sc-163656] [API connect] Recipe fails in 'Add an error column' error mode
  • Loading branch information
alexbourret authored Jan 9, 2024
2 parents cde8a66 + 6bcb5ae commit 0de270a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## [Version 1.2.1](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.1) - Bugfix release - 2023-12-13

- Fix the `Add an error column` error behaviour on the recipe
- Code-env descriptor for DSS 12

## [Version 1.1.5](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.1.5) - Bugfix release - 2023-12-13

- Fix the `Add an error column` error behaviour on the recipe
- Code-env descriptor for DSS 11

## [Version 1.2.0](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.0) - Feature and bugfix release - 2023-05-31

- Add Brotli compression
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "api-connect",
"version": "1.2.0",
"version": "1.2.1",
"meta": {
"label": "API Connect",
"description": "Retrieve data from any REST API",
Expand Down
2 changes: 1 addition & 1 deletion python-lib/dku_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ class DKUConstants(object):
API_RESPONSE_KEY = "api_response"
FORBIDDEN_KEYS = ["token", "password", "api_key_value"]
FORM_DATA_BODY_FORMAT = "FORM_DATA"
PLUGIN_VERSION = "1.2.0"
PLUGIN_VERSION = "1.2.1"
RAW_BODY_FORMAT = "RAW"
REPONSE_ERROR_KEY = "dku_error"
4 changes: 3 additions & 1 deletion python-lib/rest_api_recipe_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ def retrieve_next_page(self, is_raw_output):
logger.info("retrieve_next_page: Calling next page")
json_response = self.client.paginated_api_call(can_raise_exeption=self.can_raise)
default_dict = {
DKUConstants.REPONSE_ERROR_KEY: json_response.get(DKUConstants.REPONSE_ERROR_KEY, None)
DKUConstants.REPONSE_ERROR_KEY: ""
} if self.behaviour_when_error == "keep-error-column" else {}
if isinstance(json_response, dict) and DKUConstants.REPONSE_ERROR_KEY in default_dict:
default_dict[DKUConstants.REPONSE_ERROR_KEY] = json_response.get(DKUConstants.REPONSE_ERROR_KEY, None)
metadata = self.client.get_metadata() if self.display_metadata else default_dict
is_api_returning_dict = True
if self.extraction_key:
Expand Down
4 changes: 4 additions & 0 deletions tests/python/integration/test_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ def test_run_api_connect_relative_url_pagination(user_dss_clients):

def test_run_api_connect_check_sc_110446(user_dss_clients):
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="CHECKSC110446")


def test_run_api_connect_check_sc_163656_error_column_always_in_schema(user_dss_clients):
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="SC163656")

0 comments on commit 0de270a

Please sign in to comment.