L2 Hub
Pontus
etl
Select

L2 Construct: select

etl select

Description

SelectColumnsEndpoint extracts specified columns from an input Table.

This endpoint accepts a Table and a list of column names to select. It returns a new Table containing only the specified columns, preserving the order of rows from the original Table. If a specified column doesn't exist in the input Table, an error is returned.

Use this endpoint to reduce the number of columns in a Table, focusing on specific data points of interest. This can be particularly useful for data analysis, reporting, or preparing data for further processing.

L2 Data

  1. Provider: pontus
  2. Module: etl
  3. Action: select

Example Step

{
  "name": "insert-your-step-name",
  "type": "l2",
  "l2_data": {
    "provider": "pontus",
    "module": "etl",
    "action": "select",
    "metadata": {}
  }
}
 

Input

Example

{
  "table": {
    "headers": [
      "ID",
      "Name",
      "Age",
      "City"
    ],
    "rows": [
      [
        "1",
        "Alice",
        "30",
        "New York"
      ],
      [
        "2",
        "Bob",
        "25",
        "San Francisco"
      ]
    ]
  },
  "columns": [
    "ID",
    "Name"
  ]
}

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/etl/select-columns-input",
  "$ref": "#/$defs/SelectColumnsInput",
  "$defs": {
    "SelectColumnsInput": {
      "properties": {
        "table": {
          "$ref": "#/$defs/Table"
        },
        "columns": {
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": ["table", "columns"]
    },
    "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": [
      "ID",
      "Name"
    ],
    "rows": [
      [
        "1",
        "Alice"
      ],
      [
        "2",
        "Bob"
      ]
    ]
  }
}

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pontus.bpa/pkgs/l2/pontus/etl/select-columns-output",
  "$ref": "#/$defs/SelectColumnsOutput",
  "$defs": {
    "SelectColumnsOutput": {
      "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"]
    }
  }
}