Marquez Documentation
repository·main·Indexed 25 days ago
https://github.com/marquezproject/marquezAn open-source metadata service for the collection, aggregation, and visualization of data ecosystem metadata, focusing on data provenance, job runtime visibility, and dataset lifecycle management via the OpenLineage standard. Includes guides for Helm installation on Kubernetes, API and Web UI configuration, and usage of the Marquez Java and Python clients for reading metadata.
What's inside Marquez
- Marquez is an open source metadata service designed for the collection, aggregation, and visualization of metadata within a data ecosystem. It serves as a central hub for understanding data lineage and metadata across various data tools.
Overview of the Marquez Lineage API
mainMarquez acts as a metadata server that provides an OpenLineage-compatible REST API. This API allows users to retrieve, modify, and add metadata regarding their data pipelines. The API communicates via HTTP and returns data in JSON format. It is designed to support real-time metadata collection and exploration of datasets, jobs, and lineage.Understand Column Lineage in Marquez
mainColumn lineage provides granular metadata about how specific columns in a dataset are produced from input columns in other datasets. This is achieved using the
ColumnLineageDatasetFacetfrom the OpenLineage spec.Key features include:
- Granularity: Tracks the flow of specific fields (e.g., sensitive PII) through a pipeline.
- Transformation Metadata:
transformationDescription: A string describing the transformation applied to the input columns.transformationType: Indicates the nature of the data. Supported values areIDENTITY(exact same as input) andMASKED(no original data available, such as a hash).
Currently, column lineage is supported out-of-the-box for the Spark integration via OpenLineage.
Configure Custom Run Facets
mainFacets allow you to extend
dataset,job, andrunmetadata. A custom facet must follow these rules:- Schema Requirement: A custom facet must have a schema where the version is identifiable via a URL.
- Field Naming: Fields within the schema must not start with an underscore (
_). - Base Fields: All base facet fields (used to avoid naming conflicts) must be prefixed with an underscore (
_).
BaseFacet Properties
When implementing a facet, you must include these base properties:
_producer: A URI identifying the producer of the metadata (e.g., a git URL with a tag or SHA)._schemaURL: The URL to the corresponding version of the schema definition.
For a full list of standard run facets, refer to the OpenLineage standard facets specification.
Understand the Marquez data model
mainMarquez's data model is built on the principles of immutability and versioning to ensure reproducible lineage. The core entities are:
Job
A job represents a unit of work. It includes an
owner, a uniquename, aversion, and an optionaldescription. Jobs define dependencies via versioned inputs and artifacts via versioned outputs.Job Version
An immutable, read-only version of a job. It includes a unique
linkto the specific code used, ensuring build reproducibility. A Job Version maps specific input and output datasets to a job definition, which is critical for tracking how data flows through different jobs over time.Dataset
A dataset is a first-class value produced by job runs. It includes an
owner, a uniquename, aschema, aversion, and an optionaldescription. Datasets are grouped within a datasource (which represents the physical source).Dataset Version
An immutable, read-only version of a dataset. Each version has a unique ID representing a specific state in time. Marquez maintains a version
pointerthat is updated whenever a new change is committed. Thecurrentversion is updated internally whenever a new distinct version ID is generated via Marquez's versioning function.Structure of Custom Facets in Run metadata
mainMarquez supports OpenLineage facets to extend metadata for datasets, jobs, and runs. Custom facets must follow a specific structure to ensure compatibility:
- BaseFacet Requirements: Every custom facet must include:
_producer: A URI identifying the producer of the metadata (e.g., a git URL)._schemaURL: A URL to the corresponding version of the schema definition.
- Naming Convention: All base facet fields must be prefixed with an underscore (
_) to avoid naming conflicts with other facets. - Field Constraints: Fields within the schema must not start with an underscore (
_).
- BaseFacet Requirements: Every custom facet must include:
Understand OpenLineage Facet Optimization
mainIn Marquez, OpenLineage facets (user-defined metadata) were originally queried by scanning the
lineage_eventstable. Because theeventcolumn inlineage_eventscontains the raw JSON event, which can exceed 10MB per event, querying facets directly from this table can lead to Out-of-Memory (OOM) errors and poor performance.To optimize this, Marquez introduces dedicated facet tables (
dataset_facets,job_facets, andrun_facets). These tables store extracted facets separately, allowing for efficient queries without loading massive raw event blobs into memory. Facets in these tables are append-only and follow a first-to-last received order, meaning newer facets override older ones during query-time merging usingMapperUtils.toFacetsOrNull()logic.Define Custom Facets for Jobs
mainFacets allow you to attach extensible metadata to OpenLineage entities. A
CustomFacetis an object that can hold arbitrary properties. To ensure schema compliance, facets should ideally follow aBaseFacetstructure which requires:_producer: A URI identifying the producer of the metadata (e.g., a git URL)._schemaURL: The URL to the corresponding version of the schema definition.
Example of a facet structure in JSON schema:
{ "_producer": { "description": "URI identifying the producer of this metadata.", "type": "string", "format": "uri" }, "_schemaURL": { "description": "The URL to the corresponding version of the schema definition.", "type": "string", "format": "uri" } }How dataset schema versioning works
mainTo reduce database duplication, Marquez separates dataset schema versioning from dataset versioning.
- Dataset Version: Created every time a job produces a dataset. It captures the state of the dataset at that moment (including column-level lineage and facets).
- Schema Version: A separate abstraction representing the set of fields (mappings to dataset fields) belonging to a dataset.
When a job produces a dataset, Marquez compares the current schema against existing
dataset_schema_versions. If the schema is identical, the newdataset_versionsimply references the existingdataset_schema_version. A new schema version is only created when the fields (name and type) actually change.Equality Logic: Two schemas are considered equal if they contain the same fields, keyed by
nameandtype.- Order does not matter: Fields are sorted alphabetically before comparison.
- Descriptions do not matter: A change in a field's
descriptionis not considered a schema change.
Extending Run Metadata with Custom Facets
mainFacets allow you to extend
dataset,job, andrunmetadata. Custom facets must follow a specific structure to ensure interoperability and avoid naming conflicts.Custom Facet Requirements
- Schema: A custom facet must have a schema where a version of the schema is identifiable via a URL.
- Naming: Fields within the custom schema must not start with an underscore (
_). - Base Fields: All base facet fields are prefixed with an underscore (
_) to prevent conflicts with custom fields. A validBaseFacetrequires:_producer: A URI identifying the producer of the metadata (e.g., a git URL)._schemaURL: The URL to the corresponding version of the schema definition.
For a full list of standard run facets, refer to the OpenLineage standard facets specification.
List all datasets via GET /namespaces/{namespace}/datasets
mainThe
Datasetobject represents a data entity in Marquez. Key fields include:id: A composite identifier consisting ofnamespaceandname.name: The logical name used for identification.physicalName: The actual location/name in the underlying system (e.g.,public.mytable).fields: A list of schema elements. Each field has aname,type, and optionaltagsordescription.facets: Metadata extensions.- Standard Facets: Follow the OpenLineage specification.
- Custom Facets: Must include a
_producer(URI) and a_schemaURL(URI) to identify the schema version. Field names within custom facets must not start with an underscore (_).
currentVersion: A UUID representing the current version of the dataset metadata.
{ "id": { "namespace": "my-namespace", "name": "my-dataset" }, "type": "DB_TABLE", "name": "my-dataset", "physicalName": "public.mytable", "createdAt": "2019-05-09T19:49:24.201361Z", "updatedAt": "2019-05-09T19:49:24.201361Z", "namespace": "my-namespace", "sourceName": "my-source", "fields": [ { "name": "a", "type": "INTEGER", "tags": [] } ], "tags": [], "lastModifiedAt": null, "description": "My first dataset!", "facets": {}, "currentVersion": "b1d626a2-6d3a-475e-9ecf-943176d4a8c6" }Understand the DatasetId and JobId structures
mainMarquez uses specific ID objects to uniquely identify datasets and jobs across namespaces.
- DatasetId: An object containing
namespace(string) andname(string). - JobId: An object containing
namespace(string) andname(string).
These identifiers are used in the
inputsandoutputsarrays of aJobto define data lineage.{ "title": "DatasetId", "type": "object", "properties": { "namespace": { "type": "string" }, "name": { "type": "string" } } }- DatasetId: An object containing