Skip to content

Alternative languages (PRQL, PQL)

TL;DR

Set the language to PRQL
Terminal window
anyquery --prql
Set the language to PQL
Terminal window
anyquery --pql

Introduction

Anyquery supports out-of-the-box alternative languages to SQL. You can use PRQL or PQL to query your data. PRQL is an attempt to make SQL more human-readable, and PQL is language similar to Microsoft Kusto Query Language (KQL).

PRQL

PRQL allows you to write queries in a more human-readable way. FROM statement is at the beginning of the query, and the SELECT statement is at the end (which makes sense when writing a query). PRQL is available in the shell mode, stdin mode, and query as a flag argument.

Getting the oldest stars of Jeff Delaney (from Fireship.io) that have more than 1000 stars
from github_stars_from_user
filter stargazers_count > 1000 && user == 'codediodeio'
sort starred_at
select {
repo_name = f"{owner}/{name}",
starred_at,
stargazers_count
}
take 10

To enable PRQL, run:

Terminal window
anyquery --prql

Or once the shell mode is open, run:

.language prql
-- To switch back to SQL, run:
.language

PQL

PQL is a language that tries to bridge the gap between proprietary languages like KQL, Splunk SPL, and SQL. PQL is available in the shell mode, stdin mode, and query as a flag argument.

Getting the oldest stars of Jeff Delaney (from Fireship.io) that have more than 1000 stars
github_stars_from_user
| where stargazers_count > 1000 and user == 'codediodeio'
| sort by starred_at
| project repo_name = strcat(owner, '/', name), starred_at, stargazers_count
| take 10

To enable PQL, run:

Terminal window
anyquery --pql

Or once the shell mode is open, run:

.language pql
-- To switch back to SQL, run:
.language