JSONL file format

This page will describe how to create a JSONL file for upload into Secoda.

Create a newline-delimited JSON (JSONL) file that contains a JSON object for each resource or lineage entry that is meant to be imported into Secoda.

Resources and Lineage

Secoda expects metadata files to follow a newline-delimited JSON (JSONL) format. Two types of files can be uploaded into Secoda into this way:

  1. resources.jsonl: Contains metadata for various resources, such as tables, columns, dashboards, and charts.

  2. lineage.jsonl: Contains lineage information that describes relationships within Resources in the resouces.jsonl file (this is referred to as Internal Lineage) and relationships between Resources in the resources.jsonl file with Resources that already exist in Secoda (this is referred to as External Lineage).

Learn more about the available fields for the JSON objects here.

Example for resources.jsonl:

{"entity_type": "table", "databuilder_id": "secoda.public.order", "title": "order", "description": "Orders from KFC", "schema": "public", "database": "secoda"}
{"entity_type": "column", "databuilder_id": "secoda.public.order.order_id", "parent_databuilder_id": "secoda.public.order", "title": "order_id", "is_pk": true, "hidden": false}
{"entity_type": "dashboard", "databuilder_id": "dashboard.revenue_2023_forecast", "title": "2023 Revenue Forecast"}
{"entity_type": "chart", "databuilder_id": "dashboard.revenue_2023_forecast.yoy_growth", "parent_databuilder_id": "dashboard.revenue_2023_forecast", "title": "YoY Growth"}

Example for lineage.jsonl:

Example 1: Internal lineage between two internal resources.

{"from_identifier": { "type": "internal_resource", "databuilder_id": "internal.dashboard.123" }, "to_identifier": { "type": "internal_resource", "databuilder_id": "internal.report.456" } } 

Example 2: External lineage from an internal resource to an external table.

{ "from_identifier": { "type": "internal_resource", "databuilder_id": "internal.dashboard.789" }, "to_identifier": { "type": "external_table", "cluster": "default_cluster", "database": "sales_db", "schema": "public", "table": "orders" } } 

Example 3: External lineage from an external column to an internal resource.

Example 4: Lineage involving a SQL query that references multiple tables. Can be internal or external.

These JSON objects have several required and optional fields. See an outline of the Secoda fields here.

Example - Generating Metadata Files

There are several ways to generate a JSONL file. If you plan on using Python, we recommending defining the Secoda resources as Pydantic models. The code below shows how Secoda has defined the Resource and Lineage models using Pydantic. All the fields as part of the models are explained in the documentation above.

Using the models above, below is sample code of how to generate such JSONL files using Python:

Have any questions about how to generate a JSONL file? Get in touch at [email protected].

Last updated

Was this helpful?