Skip to content

File Imports

import { Aside } from ‘@astrojs/starlight/components’;

A type: "import" action loads a Parquet / CSV / JSON file into a table in the warehouse — the symmetric inverse of type: "export". Unlike an export (a sink), an import is a producer: the table it creates is ref()-able by downstream models, just like a table or a declaration that actually carries data.

It’s a config-only action — there’s no SQL body (like a declaration). The source is the file at location; the destination is the action’s own target.

Need to produce the file first — download it, unzip it, reshape it? Pair the import with a python script action (1.20+) it depends on: the script stages the file in-DAG, the import loads it.

-- definitions/orders_in.sqlx
config {
type: "import",
import: {
location: "s3://my-bucket/orders/*.parquet", // exact source file or glob
format: "parquet", // parquet | csv | json (json = JSONL)
overwrite: true // default true
}
}
-- definitions/clean_orders.sqlx — ref() the imported table like any other model
config { type: "table" }
SELECT order_id, total FROM ${ref("orders_in")}
  • BigQuery — compiles to native LOAD DATA OVERWRITE|INTO <table> FROM FILES(format=…, uris=['gs://…']). In-engine, using the warehouse’s own GCS access. gs:// only.
  • Postgres / Supabase — the CLI runs the import via DuckDB: it attaches the database read-write, then CREATE TABLE … AS SELECT * FROM read_parquet('<location>') (replace) or INSERT INTO … SELECT … (append). DuckDB decodes the file; the table lands in your warehouse. Reads from s3://, gs://, Supabase Storage (its S3-compatible endpoint), or a local path — filling the gap where managed Postgres/Supabase can’t read Parquet itself.

MySQL/MariaDB import isn’t supported yet.

FieldDescription
locationRequired. The exact source file/glob/URI to read (e.g. gs://b/orders/*.parquet). Used verbatim — unlike export, no filename is derived. ${} interpolation works.
formatRequired. parquet, csv, or json (JSONL).
overwritetrue (default) replaces the table (drop + create). false appends (INSERT … SELECT) into an existing table.
optionsFormat-specific passthrough (reserved).
SchemeBigQueryPostgres / Supabase
gs://✓ (native)✓ (DuckDB)
s3:// (incl. Supabase Storage)
local://… or a path✓ (handy for debugging)

Cloud sources on Postgres/Supabase read credentials from the storage section of the gitignored .df-credentials.json — the same section exports use (BigQuery uses its own GCS access; local:// needs none).