Skip to content

Conversation

fvaleye
Copy link
Collaborator

@fvaleye fvaleye commented May 24, 2025

Hey 👋,

Let's start with a simple one.

Description

Adds convenient methods to set the table description and name through the Python API:

  • Add table.alter.set_table_description(desc) method in Python
  • Add table.alter.set_table_name(name) method in Python
  • Properly handles metadata storage in the Delta table metadata

Related issue

Implementation Details

  • Leverage the validator crate
  • Limit the number of characters for update operation to a Delta Table: name (255 characters, not empty) and description (4000 characters)
  • Added Python bindings in lib.rs for set_table_name and set_table_description
  • Extended TableAlterer class with convenient API methods

Use Case

Previously, users had to use set_table_properties with specific property keys and faced issues with property validation. Now they can simply call:

  table.alter.set_table_description('my wonderful table')
  table.alter.set_table_name('my_table')

This resolves the DeltaError about property values needing to be in TableProperty enum by directly handling description/name metadata rather than as generic properties.

This update fixes the table description setting, which previously required manual property management, and provides a clean, intuitive API for standard table metadata operations.

@fvaleye fvaleye self-assigned this May 24, 2025
@fvaleye fvaleye requested a review from wjones127 as a code owner May 24, 2025 16:53
@fvaleye fvaleye added the enhancement New feature or request label May 24, 2025
@fvaleye fvaleye requested a review from roeap as a code owner May 24, 2025 16:53
@fvaleye fvaleye added the binding/python Issues for the Python package label May 24, 2025
@github-actions github-actions bot added the binding/rust Issues for the Rust crate label May 24, 2025
Copy link

ACTION NEEDED

delta-rs follows the Conventional Commits specification for release automation.

The PR title and description are used as the merge commit message. Please update your PR title and description to match the specification.

@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch 3 times, most recently from 41dfdb1 to cb25b37 Compare May 24, 2025 17:02
@fvaleye fvaleye changed the title Add a table description and name to the Delta Table from Python. feat: add a table description and name to the Delta Table from Python. May 24, 2025
@fvaleye fvaleye changed the title feat: add a table description and name to the Delta Table from Python. feat: add a table description and name to the Delta Table from Python May 24, 2025
@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch 4 times, most recently from f241c2f to ad5d359 Compare May 24, 2025 17:54
@delta-io delta-io deleted a comment from codecov bot May 24, 2025
@ion-elgreco
Copy link
Collaborator

👋 @fvaleye! This looks useful for sure, but I think it makes more sense to have a new operation that updates a subset of the table_metadata and maybe takes an Enum::TableName/TableDescription as input instead of going through the set_table_properties

@fvaleye
Copy link
Collaborator Author

fvaleye commented May 24, 2025

I hesitated whether to reuse this method or create a new one: set_table_property.rs. I'm going to rework the implementation by creating dedicated methods!

@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch 8 times, most recently from a167684 to 72452d6 Compare May 24, 2025 21:31
@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch from 2fb1690 to 6026ca3 Compare May 25, 2025 10:53
@github-actions github-actions bot removed documentation Improvements or additions to documentation proofs labels May 25, 2025
@ion-elgreco
Copy link
Collaborator

@fvaleye Maybe we can use https://github.com/Keats/validator to validate the enum properties directly? Then you don't have to check downstream again in case users directly construct the enum

@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch 4 times, most recently from 93d3298 to b55ec4e Compare May 25, 2025 11:08
@fvaleye
Copy link
Collaborator Author

fvaleye commented May 25, 2025

@fvaleye Maybe we can use https://github.com/Keats/validator to validate the enum properties directly? Then you don't have to check downstream again in case users directly construct the enum

Thanks for the idea, loved it.
Since it's a new dependency, I would rather use it everywhere by letting contributors agree on its usage, WDYT?

Add convenient methods to set table description and name through the Python API.

Signed-off-by: Florian VALEYE <[email protected]>
@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch from b55ec4e to fb1b086 Compare May 25, 2025 11:11
@ion-elgreco
Copy link
Collaborator

@fvaleye Maybe we can use https://github.com/Keats/validator to validate the enum properties directly? Then you don't have to check downstream again in case users directly construct the enum

Thanks for the idea, loved it. Since it's a new dependency, I would rather use it everywhere by letting contributors agree on its usage, WDYT?

Yes, let's see what others have to say, @roeap, @rtyler any thoughts on this?

Copy link

codecov bot commented May 25, 2025

Codecov Report

Attention: Patch coverage is 60.30534% with 52 lines in your changes missing coverage. Please review.

Project coverage is 71.22%. Comparing base (ecf6ebc) to head (710fe74).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
python/src/lib.rs 0.00% 48 Missing ⚠️
...rates/core/src/operations/update_table_metadata.rs 94.93% 1 Missing and 3 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main    #3464    +/-   ##
========================================
  Coverage   71.22%   71.22%            
========================================
  Files         148      149     +1     
  Lines       44707    44836   +129     
  Branches    44707    44836   +129     
========================================
+ Hits        31843    31935    +92     
- Misses      10794    10831    +37     
  Partials     2070     2070            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ion-elgreco
Copy link
Collaborator

There is also https://docs.rs/garde/latest/garde/ btw, which is a drop-in replacement/rewrite of validator, has some more functions. Both seem well maintained in terms of updates

@roeap
Copy link
Collaborator

roeap commented May 25, 2025

generally speaking I am a great fan of validating data and failing early if we encounter invalid data.

I have experience with neither crate, but it seems validator has a smaller size footprint and its dependencies are already covered by the existing ones.

@fvaleye
Copy link
Collaborator Author

fvaleye commented May 25, 2025

Let's add validator then! 👍
I will include the lib and ping you when it's done @ion-elgreco

@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch from 266a210 to a5cec3c Compare May 26, 2025 17:51
@fvaleye fvaleye force-pushed the feature/add-table-description-and-name-api branch from a5cec3c to 710fe74 Compare May 26, 2025 17:53
@fvaleye
Copy link
Collaborator Author

fvaleye commented May 26, 2025

I added the validator crate and some validation rules.
Ready for review @ion-elgreco

Copy link
Collaborator

@ion-elgreco ion-elgreco left a comment

Choose a reason for hiding this comment

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

Great stuff!

@ion-elgreco ion-elgreco added this pull request to the merge queue May 26, 2025
@fvaleye
Copy link
Collaborator Author

fvaleye commented May 26, 2025

FYI: I didn't add more Python tests in lib.rs because it is already tested (not covered by the coverage tool).

@ion-elgreco
Copy link
Collaborator

FYI: I didn't add more Python tests in lib.rs because it is already tested (not covered by the coverage tool).

That's fine, I only test pyo3 code in python :) because that's what matters in the end

Merged via the queue into delta-io:main with commit cc3e348 May 26, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binding/python Issues for the Python package binding/rust Issues for the Rust crate enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Alter table description
3 participants