PartiQL: set up the sample tables
Every example in the dialect series queries one of three sample tables — stage.Users, stage.Outbox, stage.Orders — and the data is built so the queries the pages print return the rows the pages show. You don't need any of it to read the series (the in-page playgrounds run right where they are), but to type along in the studio you want these tables seeded first. Both paths take a couple of minutes: import the ready-made files into DynoStudio (no AWS account), or stand up a free local DynamoDB and load everything with one command.
- Create the three
stage.*tables — all keyedpk(string) +sk(string), on-demand - Load the 2,595-item sample, by importing into DynoStudio or seeding DynamoDB Local
- Know which indexes ship with the data and which ones the series has you create yourself
- Confirm the load with a single cheap query
Get the files
One download covers both paths: the bundle below holds the three data files, the three table definitions, the local seed script, and the dataset README. Prefer single files? Each one is listed after it.
- Everything — partiql-stage.zip The whole dataset in one file (~140 KB). Extract it and you're ready for either path below.
- stage.Users sample (DynamoDB-JSON) 750 user profiles — Ada Okafor (User#9) included. Import into stage.Users.
- stage.Outbox sample (DynamoDB-JSON) 645 delivery events — exactly three of them pending. Import into stage.Outbox.
- stage.Orders sample (DynamoDB-JSON) 1,200 orders carrying the byRegionStatus key attributes. Import into stage.Orders.
- stage.Users table definition Key schema pk/sk (strings), on-demand — including the ByOrg GSI. Used by the seed script and by aws dynamodb create-table.
- stage.Outbox table definition Key schema pk/sk (strings), on-demand.
- stage.Orders table definition Key schema pk/sk (strings), on-demand — byRegionStatus is created later, in the studio.
- Local seed script A zero-dependency loader for DynamoDB Local — creates all three tables from the schemas and loads every item. Uses the aws CLI you already have.
Path A — Import into DynoStudio
1. Create the tables. In DynoStudio, create each table with partition key pk (String) and sort key sk (String), billed on-demand — or run the statements in the query box. CREATE TABLE is a DynoStudio dialect surface (DynamoDB's own PartiQL has no DDL); the "Executes as" strip shows each CreateTable call before it runs:
CREATE TABLE "stage.Users" ( PARTITION KEY pk STRING, SORT KEY sk STRING) WITH BILLING = ON_DEMAND;CREATE TABLE "stage.Outbox" ( PARTITION KEY pk STRING, SORT KEY sk STRING) WITH BILLING = ON_DEMAND;CREATE TABLE "stage.Orders" ( PARTITION KEY pk STRING, SORT KEY sk STRING) WITH BILLING = ON_DEMAND; 2. Add the ByOrg index — the series' first GSI read uses it, and on this path it doesn't exist yet:
CREATE GLOBAL INDEX "ByOrg" ON "stage.Users" PARTITION KEY (OrgId) PROJECT ALL 3. Import the data. Open each table, choose Import from CSV & JSON, pick its .ddb.json file, and review the key-aware preview before it writes. Import order doesn't matter.
Path B — Run it locally with DynamoDB Local
Prefer your own endpoint, offline and free? Stand up DynamoDB Local and let the seed script do everything: it creates all three tables from the shipped schemas (including ByOrg), then batch-writes every item, retrying anything DynamoDB leaves unprocessed — safe to re-run. You need the aws CLI and a way to run DynamoDB Local; Docker is easiest. From the extracted partiql-stage/ folder:
# 1. run DynamoDB Local (Docker shown; any method works)docker run -p 8000:8000 amazon/dynamodb-local# 2. from the folder you downloaded: create all three tables and load# 2,595 items (defaults to localhost:8000 — no AWS account needed)node seed-stage-tables.mjs When it finishes, point DynoStudio at the same endpoint (http://localhost:8000) and open the tables. One table only? node seed-stage-tables.mjs --only stage.Orders.
The indexes: one ships, two are lessons
ByOrg(onstage.Users) — ships with the setup above, soFROM "stage.Users"."ByOrg"works from your very first page.byEmail(onstage.Users) — deliberately not pre-created: building it is the CREATE GLOBAL INDEX lesson. Theemailattribute is already on every profile, so it backfills the moment you run the statement.byRegionStatus(onstage.Orders) — the multi-key GSI from Targeted reads. Its key attributes (region,tenant,status,createdAt) are on every seeded order; create it now if you want that example live when you reach it:
CREATE GLOBAL INDEX "byRegionStatus" ON "stage.Orders" PARTITION KEY (region, tenant) SORT KEY (status, createdAt) PROJECT ALL Confirm it worked
However you loaded it, open stage.Users and run one cheap keyed read:
SELECT Name, balance, address.cityFROM "stage.Users" WHERE pk = 'User#9' One row: Ada Okafor · 1,420.50 · Lagos. That's the keyed read from the First queries playground, so if it comes back you're fully set up. (Table-name error or empty result? The import/seed didn't land — re-run the path above.)
- Three tables —
stage.Users,stage.Outbox,stage.Orders— all keyedpk(string) +sk(string), on-demand. - Import path: create the tables (UI or
CREATE TABLE), addByOrg, then Import from CSV & JSON per table. - Local path:
docker run … amazon/dynamodb-local, thennode seed-stage-tables.mjs, then point DynoStudio athttp://localhost:8000. ByOrgships;byEmailandbyRegionStatusare created in the studio — that's part of the course.- A keyed read on
pk = 'User#9'returns Ada Okafor — proof the data landed.
- Run DynamoDB Local AWS docs: run DynamoDB on your own machine — free, offline, nothing to provision.
- Working with tables in DynamoDB AWS docs: creating tables, key schema, and on-demand vs provisioned billing.