Skip to content

[Feature]: Add target and source objects instead of strings for predicates #4087

@thomasfrederikhoeck

Description

@thomasfrederikhoeck

Is your feature request related to a problem?

I think the ergonomics for predicates used in the CRUD operations can be improved. Instead of using pure strings two classes called target and source should be introdices. This would make it more composable instead of combining predicates together as strings, but would also help with convertions of types such as for date and datetime.

Ìt would also remove the need for specifing target_alias and source_alias

import deltalake as dl

start_date = date(2024, 1, 1)
ids_match = dl.source("col0") == dl.target("col0")
date_match = dl.source("date_col") == dl.target("date_col")
date_is_specific = dl.target("date_col") == start_date

predicte = start_date & ids_match & date_match

table.merge(
    df,
    predicate=predicate,
).when_matched_update_all().execute()

Describe the solution you'd like

Introduce the two classes.

Describe alternatives you've considered

Keep the pure string solutions which exists today.

Priority

None

Additional context

I'm willing to help but I would probably need a bit of guides if this features should be implemented on the rust side (and exposed) or as a pure python side.

Contribution

  • I'm willing to submit a pull request for this feature
  • I can help with testing this feature
  • I can help with documentation for this feature is

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions