OpenMetadata
Search…
Trino
This guide will help you install and configure the Trino connector and run metadata ingestion workflows manually.

Requirements

Using the OpenMetadata Trino connector requires supporting services and software. Please ensure that your host system meets the requirements listed below. Then continue to follow the procedure for installing and configuring this connector.

OpenMetadata (version 0.7.0 or later)

You must have a running deployment of OpenMetadata to use this guide. OpenMetadata includes the following services:
  • OpenMetadata server supporting the metadata APIs and user interface
  • Elasticsearch for metadata search and discovery
  • MySQL as the backing store for all metadata
  • Airflow for metadata ingestion workflows
If you have not already deployed OpenMetadata, please follow the instructions to Run OpenMetadata to get up and running.

Python (version 3.8.0 or later)

Please use the following command to check the version of Python you have.
1
python3 --version
Copied!

Procedure

Here’s an overview of the steps in this procedure. Please follow the steps relevant to your use case.

1. Prepare a Python virtual environment

In this step, we’ll create a Python virtual environment. Using a virtual environment enables us to avoid conflicts with other Python installations and packages on your host system.
In a later step, you will install the Python module for this connector and its dependencies in this virtual environment.

1.1 Create a directory for openmetadata

Throughout the docs, we use a consistent directory structure for OpenMetadata services and connector installation. If you have not already done so by following another guide, please create an openmetadata directory now and change into that directory in your command line environment.
1
mkdir openmetadata; cd openmetadata
Copied!

1.2 Create a virtual environment

Run the following command to create a Python virtual environment called, env. You can try multiple connectors in the same virtual environment.
1
python3 -m venv env
Copied!

1.3 Activate the virtual environment

Run the following command to activate the virtual environment.
1
source env/bin/activate
Copied!
Once activated, you should see your command prompt change to indicate that your commands will now be executed in the environment named env.

1.4 Upgrade pip and setuptools to the latest versions

Ensure that you have the latest version of pip by running the following command. If you have followed the steps above, this will upgrade pip in your virtual environment.
1
pip3 install --upgrade pip setuptools
Copied!

2. Install the Python module for this connector

Once the virtual environment is set up and activated as described in Step 1, run the following command to install the Python module for the Trino connector.
1
pip3 install 'openmetadata-ingestion[trino]'
Copied!

3. Create a configuration file using template JSON

Create a new file called trino.json in the current directory. Note that the current directory should be the openmetadata directory you created in Step 1.
Copy and paste the configuration template below into the trino.json file you created.
Note: The source.config field in the configuration JSON will include the majority of the settings for your connector. In the steps below we describe how to customize the key-value pairs in the source.config field to meet your needs.
trino.json
1
{
2
"source": {
3
"type": "trino",
4
"config": {
5
"database": "trino_db"
6
"service_name": "local_trino",
7
"host_port": "hostname.domain.com:8080",
8
"catalog": "system"
9
}
10
},
11
"sink": {
12
"type": "metadata-rest",
13
"config": {
14
}
15
},
16
"metadata_server": {
17
"type": "metadata-server",
18
"config": {
19
"api_endpoint": "http://localhost:8585/api",
20
"auth_provider_type": "no-auth"
21
}
22
}
23
}
Copied!

4. Configure service settings

In this step we will configure the Trino service settings required for this connector. Please follow the instructions below to ensure that you’ve configured the connector to read from your Trino service as desired.

host_port

Edit the value for source.config.host_port in trino.json for your Trino deployment. Use the host:port format illustrated in the example below.
1
"host_port": "hostname.domain.com:8080"
Copied!
Please ensure that your Trino deployment is reachable from the host you are using to run metadata ingestion.

username (optional)

Edit the value for source.config.username to identify your Trino user.
1
"username": "username"
Copied!
Note: The user specified should be authorized to read all databases you want to include in the metadata ingestion workflow.

password (optional)

Edit the value for source.config.password with the password for your Trino user.
1
"password": "strong_password"
Copied!

service_name

OpenMetadata uniquely identifies services by their service_name. Edit the value for source.config.service_name with a name that distinguishes this deployment from other services, including other Trino services that you might be ingesting metadata from.
1
"service_name": "local_trino"
Copied!

database (optional)

If you want to limit metadata ingestion to a single database, include the source.config.database field in your configuration file. If this field is not included, the connector will ingest metadata from all databases that the specified user is authorized to read.
To specify a single database to ingest metadata from, provide the name of the database as the value for the source.config.database key as illustrated in the example below.
1
"database": "trino_db"
Copied!

5. Enable/disable the data profiler

The data profiler ingests usage information for tables. This enables you to assess the frequency of use, reliability, and other details.

data_profiler_enabled

When enabled, the data profiler will run as part of metadata ingestion. Running the data profiler increases the amount of time it takes for metadata ingestion, but provides the benefits mentioned above.
You may disable the data profiler by setting the value for the key source.config.data_profiler_enabled to "false" as follows. We’ve done this in the configuration template provided.
1
"data_profiler_enabled": "false"
Copied!
If you want to enable the data profiler, update your configuration file as follows.
1
"data_profiler_enabled": "true"
Copied!
Note: The data profiler is enabled by default if no setting is provided for data_profiler_enabled

6. Install the data profiler Python module (optional)

If you’ve enabled the data profiler in Step 5, run the following command to install the Python module for the data profiler. You’ll need this to run the ingestion workflow.
1
pip3 install 'openmetadata-ingestion[data-profiler]'
Copied!
The data profiler module takes a few minutes to install. While it installs, continue through the remaining steps in this guide.

7. Configure data filters (optional)

include_views (optional)

Use source.config.include_views to control whether or not to include views as part of metadata ingestion and data profiling.
Explicitly include views by adding the following key-value pair in the source.config field of your configuration file.
1
"include_views": "true"
Copied!
Exclude views as follows.
1
"include_views": "false"
Copied!
Note: source.config.include_views is set to true by default.

include_tables (optional)

Use source.config.include_tables to control whether or not to include tables as part of metadata ingestion and data profiling.
Explicitly include tables by adding the following key-value pair in the source.config field of your configuration file.
1
"include_tables": "true"
Copied!
Exclude tables as follows.
1
"include_tables": "false"
Copied!
Note: source.config.include_tables is set to true by default.

table_filter_pattern (optional)

Use source.config.table_filter_pattern to select tables for metadata ingestion by name.
Use source.config.table_filter_pattern.excludes to exclude all tables with names matching one or more of the supplied regular expressions. All other tables will be included. See below for an example. This example is also included in the configuration template provided.
1
"table_filter_pattern": {
2
"excludes": ["information_schema.*", "[\\w]*event_vw.*"]
3
}
Copied!
Use source.config.table_filter_pattern.includes to include all tables with names matching one or more of the supplied regular expressions. All other tables will be excluded. See below for an example.
1
"table_filter_pattern": {
2
"includes": ["corp.*", "dept.*"]
3
}
Copied!
See the documentation for the Python re module for information on how to construct regular expressions.
You may use either excludes or includes but not both in table_filter_pattern.

schema_filter_pattern (optional)

Use source.config.schema_filter_pattern.excludes and source.config.schema_filter_pattern.includes field to select the schemas for metadata ingestion by name. The configuration template provides an example.
The syntax and semantics for schema_filter_pattern are the same as for table_filter_pattern. Please check that section for details.

8. Configure sample data (optional)

generate_sample_data (optional)

Use the source.config.generate_sample_data field to control whether or not to generate sample data to include in table views in the OpenMetadata user interface. The image below provides an example.
Explicitly include sample data by adding the following key-value pair in the source.config field of your configuration file.
1
"generate_sample_data": "true"
Copied!
If set to true, the connector will collect the first 50 rows of data from each table included in ingestion, and catalog that data as sample data, which users can refer to in the OpenMetadata user interface.
You can exclude the collection of sample data by adding the following key-value pair in the source.config field of your configuration file.
1
"generate_sample_data": "false"
Copied!
Note: generate_sample_data is set to true by default.

9. Configure DBT (optional)

DBT provides transformation logic that creates tables and views from raw data. OpenMetadata’s integration for DBT enables you to view the models used to generate a table from that table's details page in the OpenMetadata UI. The image below provides an example.
To include DBT models and metadata in your ingestion workflows, specify the location of the DBT manifest and catalog files as fields in your configuration file.

dbt_manifest_file (optional)

Use the field source.config.dbt_manifest_file to specify the location of your DBT manifest file. See below for an example.
1
"dbt_manifest_file": "./dbt/manifest.json"
Copied!

dbt_catalog_file (optional)

Use the field source.config.dbt_catalog_file to specify the location of your DBT catalog file. See below for an example.
1
"dbt_catalog_file": "./dbt/catalog.json"
Copied!

10. Confirm sink settings

You need not make any changes to the fields defined for sink in the template code you copied into trino.json in Step 4. This part of your configuration file should be as follows.
1
"sink": {
2
"type": "metadata-rest",
3
"config": {}
4
},
Copied!

11. Confirm metadata_server settings

You need not make any changes to the fields defined for metadata_server in the template code you copied into trino.json in Step 4. This part of your configuration file should be as follows.
1
"metadata_server": {
2
"type": "metadata-server",
3
"config": {
4
"api_endpoint": "http://localhost:8585/api",
5
"auth_provider_type": "no-auth"
6
}
7
}
Copied!

12. Run ingestion workflow

Your trino.json configuration file should now be fully configured and ready to use in an ingestion workflow.
To run an ingestion workflow, execute the following command from the openmetadata directory you created in Step 1.
1
metadata ingest -c ./trino.json
Copied!

Next Steps

As the ingestion workflow runs, you may observe progress both from the command line and from the OpenMetadata user interface. To view the metadata ingested from Trino, visit http://localhost:8585/explore/tables. Select the Trino service to filter for the data you’ve ingested using the workflow you configured and ran following this guide. The image below provides an example.

Troubleshooting

ERROR: Failed building wheel for cryptography

When attempting to install the openmetadata-ingestion[trino] Python package in Step 2, you might encounter the following error. The error might include a mention of a Rust compiler.
1
Failed to build cryptography
2
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Copied!
This error usually occurs due to an older version of pip. Try upgrading pip as follows.
1
pip3 install --upgrade pip setuptools
Copied!
Then re-run the install command in Step 2.

requests.exceptions.ConnectionError

If you encounter the following error when attempting to run the ingestion workflow in Step 12, this is probably because there is no OpenMetadata server running at http://localhost:8585.
1
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8585):
2
Max retries exceeded with url: /api/v1/services/databaseServices/name/local_trino
3
(Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1031fa310>:
4
Failed to establish a new connection: [Errno 61] Connection refused'))
Copied!
To correct this problem, please follow the steps in the Run OpenMetadata guide to deploy OpenMetadata in Docker on your local machine.
Then re-run the metadata ingestion workflow in Step 12.
Last modified 23h ago