Sources file¶
The sources file tells Periplo where to look for Delta tables and what the folders
above each table mean. It is a YAML file named by PERIPLO_SOURCES_FILE
(/etc/periplo/sources.yaml in the container image) and read once, at start-up.
The file is strict on purpose: an unknown field, a repeated source name or a malformed template stops the start-up with a message that names the entry, instead of silently changing what gets discovered. Credentials never go in this file; see Environment variables.
A complete example¶
version: 1
sources:
- name: shop
uri: s3://shop-lake/ # bucket and root prefix
template: "{layer}/{domain}/{table}" # what each folder above a table means
include: [raw, curated] # optional: first-level folders to look into
labels: { environment: prod } # optional: labels for every table of this source
- name: shop_staging # a twin bucket with the same layout
uri: s3://shop-lake-staging/
template: "{layer}/{domain}/{table}"
database_prefix: stg_ # keeps its names apart from `shop`
labels: { environment: staging }
explorer: # optional
group_by: [stage] # nests the explorer: stage, then database
values:
layer: # a folder name can stand for more labels
raw: { labels: { stage: landing } }
curated: { labels: { stage: refined } }
stage: # titles, descriptions and order for display
landing: { title: "Landing", description: "As received from the shop.", order: 1 }
refined: { title: "Refined", description: "Cleaned and ready to analyse.", order: 2 }
The repository’s config/sources.example.yaml is another worked example; it is what the
container image starts with.
Top level¶
Field |
Required |
Meaning |
|---|---|---|
|
yes |
Format version. This release reads |
|
yes |
One or more sources, described below. |
|
no |
How the web console groups and presents tables. |
Sources¶
Field |
Required |
Meaning |
|---|---|---|
|
yes |
Unique name of the source, matching |
|
yes |
An |
|
yes |
What each folder level between |
|
no |
First-level folder names to look into; others are skipped. Without it, every folder is searched. |
|
no |
Text put in front of every database name of this source, for example to keep two buckets with the same layout apart. |
|
no |
Labels given to every table of the source. A label may not have the name of a template level. |
Templates¶
A template is a list of {name} levels separated by /, ending in {table}, for
example {layer}/{domain}/{table}. Level names match [a-z][a-z0-9_]*, may not repeat,
and {table} appears only once, at the end.
How tables are found¶
Discovery lists the folders under each source, level by level:
A table is the first folder, going down from the source root, that holds a
_delta_logfolder. Discovery never goes inside a table, so partitions cost nothing.Folders whose name starts with
_or.are never entered.Discovery searches down to two levels deeper than the template, and lists at most
PERIPLO_DISCOVERY_FOLDER_BUDGETfolders per source; reaching the budget makes the result partial.
How tables are named¶
For a table at s3://shop-lake/curated/sales/orders/ and the template
{layer}/{domain}/{table}:
Result |
Value |
Rule |
|---|---|---|
table |
|
The name of the table’s own folder. |
database |
|
The folders above the table joined with |
labels |
|
Each folder above the table gives the level at the same position its value. |
Folder names become SQL names in lowercase, with every character outside [a-z0-9_]
replaced by _ and a _ in front of a leading digit. A table directly under the source
root uses the source name as its database.
A path shallower than the template leaves the last levels without a value; a deeper one keeps its extra folders in the database name, without a label.
If two paths produce the same database.table, neither is published: the discovery page
reports the conflict instead of picking one, because a query must never read the wrong
table.
Explorer¶
Field |
Meaning |
|---|---|
|
Labels that nest the explorer, outermost first, before the databases. |
|
Per label, per value: |
A value’s labels let one folder name mean several things. In the example, every table
under the raw folder also gets the label stage: landing. Such derived labels may not
reuse the name of a template level or of a fixed source label.
Discovering again¶
The first discovery starts when the application starts; /health/ready answers 503
until it has finished. After that, the catalog changes only when a new discovery is
requested, from the console’s discovery page or with POST /api/v1/discovery. Asking
while one is running joins the one already running.