Open source · Apache 2.0

SQL that speaks nested data.

PartiQL is an expressive, SQL-compatible query language giving access to relational, semi-structured, and nested data — wherever it lives.

Maintained by Amazon. Developed by open-source contributors.

query.partiql Open in playground
-- orders: raw JSON documents, no schema, no flattening
SELECT o.customer.name AS customer,  -- nested path
       o.ship_to.city  AS city,
       i.sku,
       o.gift_note     AS note       -- often absent
FROM   orders AS o,
       o.items AS i                  -- unnest, like a join
WHERE  i.qty * i.price > 100
Result
<<
  { 'customer': 'Ana', 'city': 'Seattle', 'sku': 'KB-200' },
  { 'customer': 'Raj', 'city': 'Austin',  'sku': 'MON-27',
    'note': 'Happy birthday!' }
>>

Why PartiQL

One language for every shape of data

First-class nested data

PartiQL's extensions to SQL are easy to understand, treat nested data as first-class citizens, and compose seamlessly with each other and SQL. Filter, join, and aggregate across structured, semi-structured, and nested datasets.

Data storage independence

PartiQL separates the syntax and semantics of a query from the format of the data or the store being accessed, giving unified query access across data stores — with or without a regular schema.

Open source

The syntax, semantics, embeddable reference interpreter, CLI, test framework, and tests are licensed under Apache 2.0 — use, copy, and distribute your changes under the terms of your choice.

See it in action

Explore data from the PartiQL CLI

Query JSON and Ion documents interactively with the PartiQL REPL, or embed the reference implementation in your own JVM or Rust application.

Install PartiQL CLI
partiql — terminal
Example PartiQL CLI session: a query with a WITH clause and the LAG window function, followed by its result.
$ partiql -d ./db
partiql ▶ WITH revenue AS (
   |   SELECT o.region, o.qtr, SUM(o.amount) AS total
   |   FROM orders AS o
   |   GROUP BY o.region, o.qtr
   | )
   | SELECT r.region, r.qtr, r.total,
   |        LAG(r.total) OVER (PARTITION BY r.region
   |                           ORDER BY r.qtr) AS prev
   | FROM revenue AS r
   | ORDER BY r.region, r.qtr;
=== RESULT ===
[
  { 'region': 'EU', 'qtr': 1, 'total': 200, 'prev': null },
  { 'region': 'EU', 'qtr': 2, 'total': 260, 'prev': 200 },
  { 'region': 'US', 'qtr': 1, 'total': 150, 'prev': null },
  { 'region': 'US', 'qtr': 2, 'total': 130, 'prev': 150 }
]
OK!
partiql ▶ 

In production

Powering queries across AWS

Built in the open

PartiQL is open-sourced under the Apache 2.0 License. Read the charter, file an issue, or give us a star on GitHub.