Skip to content

Fix/recipe duplicates last line of csv apis#64

Open
alexbourret wants to merge 7 commits intofeature/sniffing-csv-dialectfrom
fix/recipe-duplicates-last-line-of-csv-apis
Open

Fix/recipe duplicates last line of csv apis#64
alexbourret wants to merge 7 commits intofeature/sniffing-csv-dialectfrom
fix/recipe-duplicates-last-line-of-csv-apis

Conversation

@alexbourret
Copy link
Copy Markdown
Collaborator

@alexbourret alexbourret commented Feb 27, 2026

@Ellana42 Ellana42 self-requested a review April 10, 2026 09:30
Copy link
Copy Markdown
Contributor

@Ellana42 Ellana42 left a comment

Choose a reason for hiding this comment

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

The first comment is my biggest issue - otherwise works great

# Todo: check api_response key is free and add something overwise
base_row = copy.deepcopy(metadata)
if is_raw_output:
assert_json(json_response)
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 feels dangerous to me because the assert json is not a perfect match with the json.dumps api -> it could make workflows that worked previously failed. I'd prefer catching the error from the dump and then trying other workflows

Accepted object reference
Image

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.

Assertion removed in 5dc9987

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

Comment on lines +133 to +138
decoded_csv_data = [
{
DKUConstants.API_RESPONSE_KEY: "{}".format(
decode_bytes(json_response)
)
}
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

## [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

def assert_json(variable_to_check):
if isinstance(variable_to_check, dict) or isinstance(variable_to_check, list):
return
raise Exception("Returned data is not JSON format. Try again with 'Raw JSON output' un-checked.")
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.

nit: A more specific exception might be better

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.

The whole method is removed in 5dc9987

@alexbourret alexbourret requested a review from Ellana42 April 15, 2026 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants