getschema
This page explains how to use the getschema operator in APL.
The getschema
operator in APL returns the schema of a dataset, including field names and their data types. You can use it to inspect the structure of a dataset before performing queries or transformations. This operator is useful when exploring new datasets, verifying data consistency, or debugging queries.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
Usage
Syntax
Parameters
The getschema
operator does not take any parameters.
Returns
Field | Type | Description |
---|---|---|
ColumnName | string | The name of the field in the dataset. |
ColumnOrdinal | number | The index number of the field in the dataset. |
ColumnType | string | The data type of the field. |
DataType | string | The APL-internal name for the data type of the field. |
Use case example
You can use getschema
to explore the schema of your log data before running queries.
Query
Output
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 |
This query helps you verify the available fields and their data types before further analysis.
List of related operators
- project: Use
project
to select specific fields instead of retrieving the entire schema. - extend: Use
extend
to add new computed fields to your dataset after understanding the schema. - summarize: Use
summarize
for aggregations once you verify field types usinggetschema
. - where: Use
where
to filter datasets based on field values after checking their schema. - order: Use
order by
to sort datasets after verifying schema details.
Was this page helpful?