Skip to content
Queria Docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

Publish data

How to get your own data into Queria's catalog, and how to write the declarations

How to get your own data into Queria’s catalog. It takes two things: the data itself, and declarations saying what it is.

What you need to produce

Queria serves datasets in the FDL format: a DuckLake catalog frozen into one version per update. You build and publish them with the fdl command. Getting your data into DuckLake tables is the build’s job — dropping a file somewhere does not publish it.

The tool is your choice; anything that writes DuckLake from DuckDB works. So is the input format, as long as DuckDB can read it (CSV, Parquet, JSON, Excel, whatever you fetched from an API).

The loop

uvx queria login                       # authenticate; fdl uses the same token
uvx queria create my-dataset --public  # register the dataset (private if omitted)
# write dataset.yml and *.table.yml
uvx --from fdl-cli fdl checkout https://data.queria.io/datasets/<handle>/my-dataset/ .fdl/work.sqlite
# run your build, writing into the working catalog
uvx queria validate                    # check the declarations against the data
uvx --from fdl-cli fdl commit .fdl/work.sqlite -m "First version" --author <name>
uvx --from fdl-cli fdl push .fdl/work.sqlite

The first time you run uvx queria login, you choose a handle in the browser. Your datasets belong to that handle and are published at queria.io/datasets/<handle>/<dataset name>.

Creating a dataset (queria create) and publishing it (fdl push) need a token with “Allow modifying datasets and reports” turned on. The queria login approval page turns it on by default, so there is nothing to set up from your own machine. To publish from CI, create a token with the option turned on at the API tokens page and pass it to fdl with the FDL_TOKEN environment variable. To publish an organization’s dataset from GitHub Actions without storing a token, use a GitHub Actions registration. See Authentication for details.

If you belong to an organization account, --owner says where to create the dataset. Without it, the dataset belongs to your own handle. To keep publishing as the organization, use an organization service token, which an admin creates at queria.io/accounts/<org handle>/settings/tokens — it keeps working after the person who created it leaves.

uvx queria create my-dataset --owner my-org

When the same dataset name exists in more than one of your accounts, queria edit and queria delete stop rather than guess which one you meant. Give the name as <handle>/<dataset name> instead.

From build to publish

fdl checkout copies the catalog of the version published now into a working catalog on your disk (DuckLake in SQLite). The first time, it makes an empty one. Open the working catalog with the ATTACH statement it prints and write your tables into it. New data files go to .fdl/work.sqlite.data/, next to the working catalog, and fdl push uploads them.

ATTACH 'ducklake:.fdl/work.sqlite' AS lake (DATA_PATH '…', OVERRIDE_DATA_PATH true, META_TYPE 'sqlite', DATA_INLINING_ROW_LIMIT 0);
CREATE OR REPLACE TABLE lake.main.towns AS SELECT * FROM 'towns.csv';

fdl commit makes a new version from the working catalog and the declarations, and fdl push uploads it and publishes it. Queria checks the declarations when it receives the push, and serves the version if they pass.

queria validate checks that your declarations and your data agree before fdl commit. Point it at the working catalog with the FDL_WORKING environment variable or --ducklake.

FDL_WORKING=.fdl/work.sqlite uvx queria validate           # check the declarations against the data
FDL_WORKING=.fdl/work.sqlite uvx queria validate --strict  # fail on warnings too (for CI)

The declarations

There are two kinds, kept in the directory you run fdl commit from. Directory names for *.table.yml are up to you — what a file declares comes from its contents (schema and name). The shared part follows FDL’s dataset.json. What only Queria reads (the title’s reading, themes, what a column means and so on) goes under annotations.queria.

File Content
dataset.yml (repository root, required) the dataset itself
**/*.table.yml (anywhere) one table, or several
# dataset.yml
name: calendar
title: Japanese calendar
issued: 2024-04-01               # optional: first published
description: A date spine from 1955 to 2027 with holidays, weekdays and Japanese eras.
language: ja
licenses: [CC-BY-4.0]
contributors:
  - title: Cabinet Office
    roles: [rightsHolder]
  - title: Queria
    roles: [publisher]  # the provider: who publishes this dataset
spatial_coverage: [JP]  # country codes, or 6-digit local government codes with the check digit, quoted as in "131202"
annotations:
  queria:
    title_kana: ニホンノコヨミデータ  # optional: kana reading of the Japanese title (日本の暦データ)

title_kana, issued, the publisher role and spatial_coverage correspond to fields in DCAT-GoJ, the Japanese government’s metadata standard (the title’s reading, publication date, provider and spatial coverage). Fill them in if you plan to list the dataset in a government data catalog. queria export --format dcat-goj writes them out as DCAT JSON-LD.

# models/calendar/day.table.yml
schema: calendar
name: day
title: Japanese calendar
description: A date spine with holidays, weekdays, Japanese eras and fiscal years.
primary_key: date
fields:
  - name: date
    title: Date

Do not write column types. Types, column order and nullability are read from your data, so they cannot drift from it.

Tables that share a column layout can go in one file, with YAML anchors carrying the shared part.

_fields: &fields
  - { name: local_government_code, title: Local government code, annotations: { queria: { semantic: { role: entity, name: city } } } }
  - { name: value, title: Value, annotations: { queria: { semantic: { role: measure, agg: sum } } } }
tables:
  - { schema: ssds, name: a_population, title: Population, fields: *fields }
  - { schema: ssds, name: b_land,       title: Land,       fields: *fields }

Declare the primary key

Write what identifies one row in primary_key: one column name, or a list such as [local_government_code, year] when it takes several columns.

queria validate reads the data in the working catalog and counts rows whose key value repeats and rows with NULL in a primary key column. Either one is an error. Every row of the primary key columns is read, so validating a large table takes longer.

Declare join keys

Declaring with annotations.queria.semantic what identifies a table’s rows lets search find the table through its join keys, and through column conditions that name the key. Give the same key only to columns that can be matched against each other, across datasets too.

fields:
  - name: local_government_code
    title: Local government code
    annotations:
      queria:
        semantic: { role: entity, name: city }

These are the keys name takes. Columns that can be matched after a conversion, such as 5-digit and 6-digit (with check digit) local government codes, get the same key.

Key Unit Examples
prefecture Prefecture Prefecture code, prefecture name
city Municipality Local government code, municipality name
small_area Small area (chō-chōme / aza) Census small area code (KEY_CODE), town block name
town Town (machiaza) Address Base Registry town ID (unique together with the local government code)
mesh Grid square Standard grid square (mesh) code
corporate_number Corporation 13-digit corporate number
postal_code Postal code area 7-digit postal code

A key outside this list makes queria validate warn. Publishing still goes ahead, but the table does not show up under that key in search.

The list of keys comes from entities.csv in the vocabulary queria-io/vocabulary. queria validate also warns about a column without semantic whose name is a data element in the same vocabulary (data_elements.csv), or one of its aliases, when that element identifies a key (postcode, for example). If the column is not meant as a key, write semantic: { role: dimension } and the warning goes away.

agg on a role: measure column is one of sum / avg / min / max / count; anything else is an error.

Coverage

When a published table has a city, small_area or prefecture join key, Queria reads the data when you publish and writes the areas the table covers to spatial_coverage. The table is then found when someone searches by place name for a place it covers.

  • Up to 100 municipalities are listed by their local government codes (6 digits with the check digit)
  • More than that are listed by prefecture
  • All 47 prefectures with nearly every municipality (1,500 or more) become JP

Only values made of digits are read, so a column holding only municipality names cannot give a coverage. Nor can a table with more than 10 million rows whose join key holds more than 2,000 distinct values, such as nationwide small areas. When the worked-out coverage is wrong, or the table has only latitude and longitude, write spatial_coverage on the table (a written value wins) or on the dataset. A table without its own coverage takes the dataset’s.

spatial_coverage: ["082201"]  # a table that holds Tsukuba only

Period

When a published table has a column saying when each row’s numbers are from, Queria reads the data when you publish and writes the first and last periods to temporal_coverage. The table is then found when the MCP server’s search_catalog is given a year it covers.

The column is chosen by name: only the first of these, in this order, that the table has is read (when it gives no period, the later ones are not tried): year, fiscal_year, survey_year, data_year (year); year_month, survey_month (month); date, survey_date, observed_date, measured_on, reference_date, as_of_date (day). Values are written as fine as the column: 2020, 2020-04 or 2020-04-01. A year column is read only for 4-digit numbers, so a column of Japanese era years cannot give a period.

Dates about the row’s subject, such as a permit date or an opening date, are not read as a period. When there is no column to read, or the worked-out period is wrong, write temporal_coverage on the table (a written value wins). A table without its own period takes the dataset’s temporal_coverage.

temporal_coverage: { start: "2015", end: "2020" }  # a table holding 2015 to 2020

Themes

Writing what field the data belongs to in annotations.queria.themes lets the MCP server’s search_catalog find the table when given that theme. In dataset.yml it applies to every table of the dataset; in *.table.yml, to that table only. A table without its own takes the dataset’s. List as many as apply.

annotations:
  queria:
    themes: [population, housing_land]

There are 17 themes, after the major statistical fields of e-Stat (the portal for Japanese government statistics): land_climate, population, labour, agriculture, mining_manufacturing, commerce_services, economy, housing_land, energy_water, transport_tourism, ict_science, education_culture, government_finance, justice_safety_environment, social_security_health, international, other. When unsure which one fits, the examples in the vocabulary’s themes.csv are a guide. queria validate warns about a name outside the list, and search cannot narrow to it.

What happens when you make it public

A dataset is either public or private. While it is private, only you (and members of your organization) can see it. Admins can also limit an organization’s dataset to specific members and teams (who can access an organization’s datasets). A free account can keep up to 5 GB of private datasets in total (Limits). To switch:

uvx queria create my-dataset --public              # decide at creation
uvx queria edit my-dataset --visibility public     # change it later

Once public, it appears in these places.

Where What is shown
Dataset list A card with the title, description, tags and table count
Table search on that list Table and column names, titles and descriptions
The dataset page Tables, columns, SQL definitions, lineage and history
sitemap.xml and llms.txt URLs of the dataset and its tables

Your handle is shown everywhere. Cards in the list and the dataset page both render it as <handle> / <dataset>, so readers always know who published the data.

Search engines may crawl these pages. Making the dataset private again stops it from being listed on Queria, but removal from search engine indexes takes time.

A change to the visibility setting takes up to 60 seconds to reach data delivery. For those 60 seconds after you switch back to private, anyone who already knew the delivery URL may still be able to read the data.

What trips people up

Licenses are never guessed. An id in the registry can be written as is. You may omit them, but then you reserve every right and what others may do with the data is left to Queria’s terms of use — validate says so as a warning.

For a license that is not in the registry, or data that comes only with the distributor’s terms of use and no named license, write id: other with the terms. The dataset page shows title as the license, linked to url when you give one. validate stops when commercial_use or url is missing.

licenses:
  - id: other
    title: State that the distributor's API was used and link to the distributor (terms of use)
    url: https://example.go.jp/terms
    commercial_use: true         # whether commercial use and redistribution are allowed; data with false cannot be published
    attribution_required: true   # whether attribution is required

If your *.table.yml files live under dbt’s model-paths, add *.table.yml to .dbtignore. dbt reads every .yml there as one of its own property files and fails on these. validate tells you when this is missing.

Small tables may produce no parquet at all. DuckLake inlines values into the catalog below a row threshold, so a dataset can end up with no data files. Set DATA_INLINING_ROW_LIMIT to 0, as in the ATTACH statement fdl checkout prints. fdl commit stops while inlined rows remain.

A push goes only on top of the version published now. If someone else pushed after your fdl checkout, fdl push is refused. Start again from fdl checkout.

Deciding what to write

How to name tables and columns, which types to use, the grain and the keys are in Dataset conventions; which layer each sentence belongs to is in Writing descriptions.

Letting an agent do it

Both the publishing steps and the writing conventions ship as agent skills. See Queria skill for installation.

  • queria-publish-dataset — register, build and publish
  • queria-describe-dataset — what to write where

Was this page helpful?