getschema
This page explains how to use the getschema operator in APL.
The getschema operator in APL returns the schema of the input, including field names and their data types. You can use it to inspect the structure of the input at any point in your query pipeline. This operator is useful when exploring data structures, verifying data consistency, or debugging queries.
Usage
Syntax
| getschemaParameters
The getschema operator doesn’t take any parameters.
Returns
| Field | Type | Description |
|---|---|---|
| ColumnName | string | The name of the field in the input. |
| ColumnOrdinal | number | The index number of the field in the input. |
| ColumnType | string | The data type of the field. |
| DataType | string | The APL-internal name for the data type of the field. |
Use case example
Query
['sample-http-logs'] | getschemaOutput
| ColumnName | DataType | ColumnOrdinal | ColumnType |
|---|---|---|---|
| _sysTime | datetime | 0 | datetime |
| _time | datetime | 1 | datetime |
| content_type | string | 2 | string |
| geo.city | string | 3 | string |
| geo.country | string | 4 | string |
| id | string | 5 | string |
List of related operators
- project: Use
projectto select specific fields instead of retrieving the entire schema. - extend: Use
extendto add new computed fields to your input after understanding the schema. - summarize: Use
summarizefor aggregations once you verify field types usinggetschema. - where: Use
whereto filter your input based on field values after checking their schema. - order: Use
order byto sort your input after verifying schema details.