Skip to content

[MCC-1532869] Python Lib-Details section is missing for error message if first_n_rows parameter is not parsed - #61

Merged
abutsyk-mdsol merged 1 commit into
mainfrom
fix/MCC-1532869_int
Sep 1, 2026
Merged

[MCC-1532869] Python Lib-Details section is missing for error message if first_n_rows parameter is not parsed#61
abutsyk-mdsol merged 1 commit into
mainfrom
fix/MCC-1532869_int

Conversation

@ibaig-mdsol

Copy link
Copy Markdown
Contributor

fix

  • [KI]Python Lib-Details section is missing for error message if first_n_rows parameter is not parsed
  • MCC-1532869

Checklist

  • Review the pull request to fix typos and ensure variable/function names are intuitive, etc.
  • Make sure the pull request does not have excessive number of unnecessary commits. Utilize the git commit --amend --no-edit command to reduce commit messages when making small file changes (like changing linespacing).
  • Make sure you have added unit tests for the code changes. Tests should be added in the tests/ folder.
  • Modify docs, if required. Add any new documentation in the doc/ folder.
  • Rebase on latest active development branch (develop/main).

Changes Summary

This PR improves input validation for fetch_data so invalid first_n_rows values produce a clear, structured ValidationError before any transport call is made.

What changed

  • Added integer coercion/validation helper in default.py.
  • Updated fetch_data to validate/coerce first_n_rows through that helper in default.py.
  • Added test coverage for non-numeric inputs ("ten" and {}) in test_fetch_data.py.

Behavior change

  • first_n_rows values that cannot be converted to int now raise ValidationError with:
  • error code: INT_001
  • detailed conversion message
  • field detail for first_n_rows
  • expected guidance: "Ensure you provide a numeric value for this field."
  • No transport request is sent when validation fails.

Why

This makes client-side failures easier to diagnose and keeps error formatting consistent with the SDK’s structured validation model.

Deployment Notes

  • None

Example

from dataconnect import DataConnectClient
from uuid import UUID

user_token = "<token>" # From iMedidata > Data Connect > Developer Center

try:
	with DataConnectClient.connect(
        host="enodia-gateway-sandbox.platform.imedidata.net",
        port=443,
    	token=user_token) as dataconnect_client:
		dataset_uuid = UUID("d6ca6e81-6372-5848-a7c6-69f697485a4a")
		
		 # Fetch only the first 10 rows from the server
		data = dataconnect_client.fetch_data(
			dataset_uuid=dataset_uuid, first_n_rows="ten")
		
		print(data.head(3))

except Exception as e:
    print(f"Error: {e}")

Output

Error: Error Code: [INT_001]
Message: invalid literal for int() with base 10: 'ten'
Timestamp: 2026-08-31T17:51:56Z
Details:

Error Detail:
Field: first_n_rows
Expected: Ensure you provide a numeric value for this field.

@abutsyk-mdsol
abutsyk-mdsol merged commit 2a2222e into main Sep 1, 2026
5 checks passed
@abutsyk-mdsol
abutsyk-mdsol deleted the fix/MCC-1532869_int branch September 1, 2026 07:02
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