Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[#12196] fix(python): Deserialize datetime fields in AuditDTO#12197

Open
niraj-mx07 wants to merge 2 commits into
apache:mainapache/gravitino:mainfrom
niraj-mx07:fix-auditdto-datetimeniraj-mx07/gravitino:fix-auditdto-datetimeCopy head branch name to clipboard
Open

[#12196] fix(python): Deserialize datetime fields in AuditDTO#12197
niraj-mx07 wants to merge 2 commits into
apache:mainapache/gravitino:mainfrom
niraj-mx07:fix-auditdto-datetimeniraj-mx07/gravitino:fix-auditdto-datetimeCopy head branch name to clipboard

Conversation

@niraj-mx07

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

  1. Updated AuditDTO to use datetime instead of str for _create_time and _last_modified_time.
  2. Configured custom decoder and encoder functions in dataclasses_json metadata to properly parse the ISO-8601 strings into datetime objects.
  3. Updated the return types of create_time() and last_modified_time() methods to properly return datetime.
  4. Modified python unit tests that incorrectly tested for strings to compare against datetime objects.

Why are the changes needed?

The python client's AuditDTO was failing to deserialize datetime fields from JSON, keeping them as raw ISO-8601 strings (and marked with TODO: Can't deserialized datetime from JSON). This violated the Audit interface, which defines create_time() and last_modified_time() to return datetime objects. This change fixes the type mismatch at runtime.

Fix: #12196

Does this PR introduce any user-facing change?

Yes, AuditDTO.create_time() and AuditDTO.last_modified_time() in the Python client will now correctly return datetime objects instead of strings, aligning with the expected interface.

How was this patch tested?

  • Ran and updated existing python unit tests (test_relational_table.py, test_table_dto.py, test_responses.py) which now correctly assert against datetime objects.

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.

[Bug] Python client AuditDTO fails to deserialize datetime fields and violates Audit interface

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.