Skip to content

Creating a custom writer for clustering support #217

@Montana

Description

@Montana

Hey all,

Since DeltaTableWriter doesn't currently support specifying clustering columns directly, would it be feasible to potentially extend the DeltaTableWriter class? Something like the following:

from koheesio.steps.writers import DeltaTableWriter
from typing import List, Optional

class ClusteredDeltaTableWriter(DeltaTableWriter):
    cluster_by: Optional[List[str]] = None
    
    def execute(self) -> None:
        super().execute()
        
        # add clustering 
        if self.cluster_by:
            from delta.tables import DeltaTable
            delta_table = DeltaTable.forPath(self.spark, self.path)
            delta_table.alter().addClusterBy(self.cluster_by)

I appreciate it everyone.

Sincerely,
Michael Mendy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions