Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow df_concat to be created without a linker #2144

Merged
merged 2 commits into from
Apr 29, 2024

Conversation

RobinL
Copy link
Member

@RobinL RobinL commented Apr 16, 2024

Closes #2142

The vertically_concatenate_sql routine now takes specific arguments rather than accepting a linker. This allows it to be used in cases where a linker is unavailable such as profile_columns.

This will allow the code to be used in a variety of other scenarios where __splink__df_concat` is needed such as if we're analysing blocking rules outside of the context of a linker.

This is built on top of #2143 which should be merged first.


pipeline = CTEPipeline(input_dataframes)
# If the user has provided any ColumnExpression, convert to string
Copy link
Member Author

Choose a reason for hiding this comment

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

Lines 256-264 is a separate bug I found in this code whereby ColumnExpressions were not being converted into strings

@@ -14,7 +15,11 @@
from .linker import Linker


def vertically_concatenate_sql(linker: Linker) -> str:
def vertically_concatenate_sql(
Copy link
Member Author

Choose a reason for hiding this comment

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

Main changes are here - rather than accepting a linker, this now accepts arguments, meaning it can be used outside the context of a linker

@RobinL RobinL changed the base branch from process_input_tables_simplification to splink4_dev April 16, 2024 09:06
@RobinL RobinL changed the title (WIP) Remove linker from df concat Allow df_concat to be created without a linker Apr 16, 2024

tables_as_splink_dataframes = {}
existing_tables = []

if not input_aliases:
# If any of the input_tables are strings, this means they refer
Copy link
Member Author

Choose a reason for hiding this comment

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

This doesn't work if the user provides e.g. fake_1000.parquet (a filename rather than a table). To be consistent with what happens when we register tables in linker.py, we'll just give every table an alias for now

f"_splink__input_table{i}" for i, _ in enumerate(input_tables)

@RobinL RobinL requested review from ADBond and removed request for ADBond April 22, 2024 13:31
@RobinL RobinL force-pushed the remove_linker_from_df_concat branch from 6bca1ea to bc5eb21 Compare April 24, 2024 08:35
Copy link
Contributor

@ADBond ADBond left a comment

Choose a reason for hiding this comment

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

Great! 👍

def vertically_concatenate_sql(linker: Linker) -> str:
def vertically_concatenate_sql(
input_tables: Dict[str, SplinkDataFrame],
salting_reqiured: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

typo of required here

@RobinL RobinL merged commit 34a688a into splink4_dev Apr 29, 2024
15 checks passed
@RobinL RobinL deleted the remove_linker_from_df_concat branch April 29, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants