Skip to content

Make FromTableRow a publicly exported trait #356

@abhiaagarwal

Description

@abhiaagarwal

As I was working on adding additional tests, I found this in the test-utils feature

pub trait FromTableRow: Sized {
/// The type used to identify this record (usually an ID field)
type Id: Eq + Clone;
/// Convert a TableRow into this type, returning None if conversion fails
fn from_table_row(table_row: &TableRow) -> Option<Self>;
/// Get the identifier for this record (used for updates/deletes)
fn id(&self) -> Self::Id;
}

This would be super nice to be part of etl's public API, so destinations can use it to avoid defining their own traits. I'd also want to include a FromTableRowBatch trait, since in arrow-land, the columnar data model makes dealing with single rows memory-inefficient.

Happy to open an MR if think this would be an okay addition :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions