Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## [Version 1.2.7](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.7) - Feature - 2026-02-18

- Detecting dialect for better csv decoding
- Fixing duplication of last line in csv APIs using the recipe
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing mention of the new string dump

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 7bc0c49

- Dumping API's response as a last resort

## [Version 1.2.6](https://github.com/dataiku/dss-plugin-api-connect/releases/tag/v1.2.6) - Feature - 2025-09-24

Expand Down
2 changes: 1 addition & 1 deletion python-connectors/api-connect_dataset/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def generate_rows(self, dataset_schema=None, dataset_partitioning=None,
else:
record_count += 1
yield {
DKUConstants.API_RESPONSE_KEY: "{}".format(decode_bytes(data))
DKUConstants.API_RESPONSE_KEY: decode_bytes(data)
}
if is_records_limit and record_count >= records_limit:
break
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", "secure_token"]
FORM_DATA_BODY_FORMAT = "FORM_DATA"
PLUGIN_VERSION = "1.2.7-beta.1"
PLUGIN_VERSION = "1.2.7-beta.2"
RAW_BODY_FORMAT = "RAW"
REPONSE_ERROR_KEY = "dku_error"
27 changes: 21 additions & 6 deletions python-lib/rest_api_recipe_session.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataikuapi.utils import DataikuException
from rest_api_client import RestAPIClient
from safe_logger import SafeLogger
from dku_utils import parse_keys_for_json, get_value_from_path, decode_csv_data, de_NaN
from dku_utils import parse_keys_for_json, get_value_from_path, decode_csv_data, de_NaN, decode_bytes
from dku_constants import DKUConstants
import copy
import json
Expand Down Expand Up @@ -111,9 +111,14 @@ def retrieve_next_page(self, is_raw_output):
if is_error_message(json_response):
base_row.update(parse_keys_for_json(json_response))
else:
base_row.update({
DKUConstants.API_RESPONSE_KEY: json.dumps(json_response)
})
try:
base_row.update({
DKUConstants.API_RESPONSE_KEY: json.dumps(json_response)
})
except Exception:
base_row.update({
DKUConstants.API_RESPONSE_KEY: decode_bytes(json_response)
})
else:
if isinstance(json_response, dict):
base_row.update(parse_keys_for_json(json_response))
Expand All @@ -125,8 +130,18 @@ def retrieve_next_page(self, is_raw_output):
base_row.update(self.initial_parameter_columns)
page_rows.append(base_row)
else:
json_response = decode_csv_data(json_response)
for row in json_response:
decoded_csv_data = decode_csv_data(json_response)
is_api_returning_dict = False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks compatibility too but I believe this whole functionnality was introduced in an alpha for a client so probably not problematic

if not decoded_csv_data and json_response:
logger.warning("Data is not in CSV format. Dumping it in text mode.")
decoded_csv_data = [
{
DKUConstants.API_RESPONSE_KEY: "{}".format(
decode_bytes(json_response)
)
}
Comment on lines +137 to +142
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
decoded_csv_data = [
{
DKUConstants.API_RESPONSE_KEY: "{}".format(
decode_bytes(json_response)
)
}
decoded_csv_data = [
{
DKUConstants.API_RESPONSE_KEY: decode_bytes(json_response)
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c1e81b0

]
for row in decoded_csv_data:
base_row = copy.deepcopy(metadata)
base_row.update(parse_keys_for_json(row))
base_row.update(self.initial_parameter_columns)
Expand Down