Pipelines

Using

Pipelines are like saved queries. They produce a data set that would otherwise be a very long command.

View

Pipelines come with some built-in, and can be installed via plugins. To see what is currently available:

mbpy pipelines --help

For example:

mbpy pipelines enrollment-breakdown

Which outputs the following:

                                       count
class_grade_number class_grade gender
2                  PS 1        Female     8
                               Male       2
4                  PS 3        Female     7
                               Male       3
                   PYP 3       Female     5
                               Male       3
5                  PS 4        Female     7
                               Male      13
6                  PS 5        Female     6
                               Male      14
7                  MS 6        Female     4

Pipelines can also be used with the EXTRACT keyword, which will let allow you to pass it to a loader. Let's load it with our pretty printer PPRINT:

mbpy \
    EXTRACT \
        from-pipeline \
            --name enrollment-breakdown \
    PPRINT
  class_grade_number          │ class_grade       │ gender     │ count
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  2                           │ PS 1              │ Female     │ 8
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  2                           │ PS 1              │ Male       │ 2
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  4                           │ PS 3              │ Female     │ 7
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  4                           │ PS 3              │ Male       │ 3
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  4                           │ PYP 3             │ Female     │ 5
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  4                           │ PYP 3             │ Male       │ 3
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  5                           │ PS 4              │ Female     │ 7
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  5                           │ PS 4              │ Male       │ 13
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
  6                           │ PS 5              │ Female     │ 6
╶─────────────────────────────┼───────────────────┼────────────┼─────────╴
...

Last updated