Skip to content

Self documenting joins #2472

@tk3369

Description

@tk3369

SQL can be self documenting in joins when you prefix each column. For example:

select a.x, b.y
from tab1 a
inner join tab2 b on b.id = a.id

In DataFrames.jl, it's unclear where the columns came from:

df = innerjoin(tab1, tab2, on = :id)
select!(df, :x, :y)

Was it discussed before how to make the code more self documenting?

A related issue is that I often have to limit the columns from the dataframes anyways before joining:

tab1_tmp = select(tab1, :id, :x)
tab2_tmp = select(tab2, :id, Not(3:10))
innerjoin(tab1_tmp, tab2_tmp, on = :id)

So maybe it's more convenient if I were able to do this in one go:

innerjoin(tab1, tab2, on = :id, left_columns = [:x], right_columns = [:y])

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions