Help › Explore a database
Run PartiQL on DynamoDB
Write SELECT, INSERT, UPDATE and DELETE in a query tab on a DynamoDB connection, and know before a statement runs whether it reads by key or scans the table.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
A query tab on a DynamoDB connection takes PartiQL, the SQL-shaped language DynamoDB understands. It has four statements and no more:
SELECT * FROM "Orders" WHERE customer = 'c-1042' AND placed >= 20260601
ORDER BY placed DESC;
INSERT INTO "Orders" VALUE {'customer': 'c-1042', 'placed': 20261011, 'total': 59};
UPDATE "Orders" SET status = 'refunded' REMOVE note
WHERE customer = 'c-1042' AND placed = 20261009;
DELETE FROM "Orders" WHERE customer = 'c-1042' AND placed = 20261009;
There are no joins, no CREATE or DROP, and no transactions that stay
open. Names are case-sensitive; write a table's name in double quotes and
text in single quotes. To read through a secondary index, name it after
the table: FROM "Orders"."by_status".
Statements end with a semicolon. Each runs as one request, with like any statement.
A query or a scan
DynamoDB decides from the WHERE how a SELECT reads, and the bill
follows:
- When the
WHEREnames the partition key with=orIN, in every branch of anOR, the statement is a query: only the matching items are read. - Otherwise it is a scan: every item of the table is read, and billed
for, whatever the
WHEREkeeps.WHERE total > 100on a table of a million items reads a million items.
Querlyn tells you which one a statement is, three times over:
- In the editor, a
SELECTthat is a scan is underlined as a warning, once Querlyn knows the table's key. When one of the table's indexes is keyed by an attribute theWHEREnames, the warning says whichFROMwould make it a query. - Before it runs, the first of the result's Messages says whether the statement is a query or a scan, and for a scan about how many items and bytes the table holds. DynamoDB describes the table for this without reading any item.
- On a Production connection, a scan asks first, with the same figures. Ask before a scan in the connection's settings changes when Querlyn asks; see Connect to Amazon DynamoDB.
A statement Querlyn cannot read, or a table it cannot describe, is treated as a possible scan: on Production it asks.
Results a page at a time
Rows are read a page at a time, as many items as the grid asks for, and the next page only when you scroll to it. After every page the result's Messages say what it consumed, as DynamoDB reported it, and the total so far.
A SELECT whose WHERE keeps almost nothing would otherwise read on
through the whole table to fill one page. When twenty pages in a row
bring no row, Querlyn stops and says that the read is not complete: name
the partition key, read through an index, or scan the table with a limit
in its items tab.
The columns of a SELECT that names its attributes are those
attributes, in the order the statement lists them; an attribute no item
of the first page has is still a column. SELECT * shows the key
attributes first, then the others by name. Attributes that only later
pages bring are gathered in Other attributes.
The grid shows every DynamoDB type without loss; see Browse a DynamoDB table's items. The grid's cells cannot be typed in: change an item with a statement, or in the table's items tab (see Change a DynamoDB item).
Writes
An UPDATE or a DELETE changes one item and must name its whole
primary key with =. DynamoDB refuses one that does not, and the editor
marks it as an error when it knows the table's key. An INSERT is
refused when an item with its key exists.
DynamoDB applies a write when it runs, and nothing rolls it back. On a
Production connection every write asks first, as does a statement Querlyn
cannot read. A read-only connection runs only SELECT.
Completion
Completion offers the four statements, the region's tables after FROM,
INTO and UPDATE, a table's indexes after its name and a dot, and a
table's attributes where one fits: in a WHERE the partition key first,
then the sort key, then attributes that an index is keyed by. Attributes
beyond the key come from the sample of items Querlyn reads and from items
you have loaded; see
Connect to Amazon DynamoDB.
What is not there
A statement with parameters (?) cannot be given values here, and
transactions and batches of statements are not sent. Explain does not apply: DynamoDB has no query plans.
Notebooks have no PartiQL cells.
Help for Querlyn 0.1.0. All help topics