Skip to content

Commit 774460f

Browse files
authored
Merge pull request #57 from dataiku/bug/sc-257503-fix-variables-columns-renaming
fix: [sc-257503] [API-connect] Variables columns renaming feature is broken
2 parents 1cf91d8 + 939611f commit 774460f

6 files changed

Lines changed: 16 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [Version 1.2.5](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.5) - Bugfix release - 2025-02-28
4+
5+
- Fix issue with variables columns renaming
6+
37
## [Version 1.2.4](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.4) - Feature and bugfix release - 2025-02-18
48

59
- Fix xml decoding for content type application/rss+xml

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id": "api-connect",
3-
"version": "1.2.4",
3+
"version": "1.2.5",
44
"meta": {
55
"label": "API Connect",
66
"description": "Retrieve data from any REST API",

python-lib/dku_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ class DKUConstants(object):
22
API_RESPONSE_KEY = "api_response"
33
FORBIDDEN_KEYS = ["token", "password", "api_key_value", "secure_token"]
44
FORM_DATA_BODY_FORMAT = "FORM_DATA"
5-
PLUGIN_VERSION = "1.2.4"
5+
PLUGIN_VERSION = "1.2.5-beta.1"
66
RAW_BODY_FORMAT = "RAW"
77
REPONSE_ERROR_KEY = "dku_error"

python-lib/dku_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111

1212
def get_dku_key_values(endpoint_query_string):
13+
return {key_value.get("from"): key_value.get("to") for key_value in endpoint_query_string if key_value.get("from")}
14+
15+
16+
def get_dku_duplicated_key_values(endpoint_query_string):
1317
result = defaultdict(list)
1418
for kv in endpoint_query_string:
1519
if kv.get('from') and kv.get('to'):

python-lib/rest_api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pagination import Pagination
55
from safe_logger import SafeLogger
66
from loop_detector import LoopDetector
7-
from dku_utils import get_dku_key_values, template_dict, format_template, is_reponse_xml, xml_to_json
7+
from dku_utils import get_dku_key_values, get_dku_duplicated_key_values, template_dict, format_template, is_reponse_xml, xml_to_json
88
from dku_constants import DKUConstants
99
from rest_api_auth import get_auth
1010

@@ -196,7 +196,7 @@ def set_metadata(self, metadata_name, value):
196196

197197
@staticmethod
198198
def get_params(endpoint_query_string, keywords, allow_list=False):
199-
templated_query_string = get_dku_key_values(endpoint_query_string)
199+
templated_query_string = get_dku_duplicated_key_values(endpoint_query_string)
200200
ret = {}
201201
for key in templated_query_string:
202202
ret.update({key: format_template(templated_query_string.get(key, ""), allow_list=allow_list, **keywords) or ""})

tests/python/integration/test_scenario.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,7 @@ def test_run_api_connect_check_sc_163656_error_column_always_in_schema(user_dss_
5353

5454
def test_run_api_connect_xml_handling(user_dss_clients):
5555
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="XML_HANDLING")
56+
57+
58+
def test_run_api_connect_parameters_renaming(user_dss_clients):
59+
dss_scenario.run(user_dss_clients, project_key=TEST_PROJECT_KEY, scenario_id="COLUMNPARAMETERRENAMING")

0 commit comments

Comments
 (0)