L2 Construct: filter
etl filterDescription
FilterTableEndpoint filters the input Table based on specified column-value pairs. It takes a Table and an array of Filter structs, where each Filter specifies a column and a list of acceptable values for that column. The endpoint returns a new Table containing only the rows that match all specified filters.
L2 Data
- Provider: pontus
- Module: etl
- Action: filter
Example Step
{
"name": "insert-your-step-name",
"type": "l2",
"l2_data": {
"provider": "pontus",
"module": "etl",
"action": "filter",
"metadata": {}
}
}
Input
Example
{
"table": {
"headers": ["Date", "Product", "Sales", "Quantity"],
"rows": [
["2023-01-01", "A", 100, 5],
["2023-01-01", "B", 200, 3],
["2023-01-02", "A", 150, 7],
["2023-01-02", "B", 180, 4]
]
},
"logical_operator": 1,
"filters": [
{
"column": "Product",
"operator": "==",
"value": "A"
},
{
"column": "Sales",
"operator": "in",
"value": [100, 150]
}
]
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/etl/filter-table-input",
"$ref": "#/$defs/FilterTableInput",
"$defs": {
"Filter": {
"properties": {
"column": {
"type": "string"
},
"operator": {
"type": "string"
},
"value": true
},
"additionalProperties": false,
"type": "object",
"required": ["column", "operator", "value"]
},
"FilterTableInput": {
"properties": {
"table": {
"$ref": "#/$defs/Table"
},
"logical_operator": {
"type": "integer"
},
"filters": {
"items": {
"$ref": "#/$defs/Filter"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["table", "logical_operator", "filters"]
},
"Table": {
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"headers": {
"items": {
"type": "string"
},
"type": "array"
},
"rows": {
"items": {
"items": true,
"type": "array"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["headers", "rows"]
}
}
}
Output
Example
{
"result_table": {
"headers": ["Date", "Product", "Sales", "Quantity"],
"rows": [["2023-01-01", "A", 100, 5]]
}
}
Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://pontus.bpa/pkgs/l2/pontus/etl/filter-table-output",
"$ref": "#/$defs/FilterTableOutput",
"$defs": {
"FilterTableOutput": {
"properties": {
"result_table": {
"$ref": "#/$defs/Table"
}
},
"additionalProperties": false,
"type": "object",
"required": ["result_table"]
},
"Table": {
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"headers": {
"items": {
"type": "string"
},
"type": "array"
},
"rows": {
"items": {
"items": true,
"type": "array"
},
"type": "array"
}
},
"additionalProperties": false,
"type": "object",
"required": ["headers", "rows"]
}
}
}