The project-away operator in APL is used to exclude specific fields from the output of a query. This operator is useful when you want to return a subset of fields from a dataset, without needing to manually specify every field you want to keep. Instead, you specify the fields you want to remove, and the operator returns all remaining fields.

You can use project-away in scenarios where your dataset contains irrelevant or sensitive fields that you do not want in the results. It simplifies queries, especially when dealing with wide datasets, by allowing you to filter out fields without having to explicitly list every field to include.

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

| project-away FieldName1, FieldName2, ...

Parameters

  • FieldName: The field you want to exclude from the result set.

Returns

The project-away operator returns the input dataset excluding the specified fields. The result contains the same number of rows as the input table.

Use case examples

In log analysis, you might want to exclude unnecessary fields to focus on the relevant fields, such as timestamp, request duration, and user information.

Query

['sample-http-logs']
| project-away status, uri, method

Run in Playground

Output

_timereq_duration_msidgeo.citygeo.country
2023-10-17 10:23:00120u1SeattleUSA
2023-10-17 10:24:00135u2BerlinGermany

The query removes the status, uri, and method fields from the output, keeping the focus on the key fields.

Wildcard

Wildcard refers to a special character or a set of characters that can be used to substitute for any other character in a search pattern. Use wildcards to create more flexible queries and perform more powerful searches.

The syntax for wildcard can either be data* or ['data.fo']*.

Here’s how you can use wildcards in project-away:

['sample-http-logs']
| project-away status*, user*, is*,  ['geo.']*

Run in Playground

['github-push-event']
| project-away push*, repo*, ['commits']*

Run in Playground

  • project: The project operator lets you select specific fields to include, rather than excluding them.
  • extend: The extend operator is used to add new fields, whereas project-away is for removing fields.
  • summarize: While project-away removes fields, summarize is useful for aggregating data across multiple fields.