Skip to content

Add a pipe method #723

@williambdean

Description

@williambdean

Think that it could be pretty convenient to add a pipe method. Any thoughts? I can create a PR if it makes sense

from pypika import Query
from pypika.queries import QueryBuilder


def filter_to_desired_rows(query: QueryBuilder, values_to_select) -> QueryBuilder:
    ...

def aggregated_statistics(query: QueryBuilder, groups) -> QueryBuilder: 
    ...
    

initial_query = Query.from_("my_table")
query = (
    initial_query
    .pipe(filter_to_desired_rows, values_to_select=...)
    .pipe(aggregated_statistics, groups=...)
)

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