> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Run the Glue Connector Externally

> Configure AWS Glue Data Catalog metadata ingestion, including Iceberg tables, with a YAML workflow that you run externally.

![Glue](https://docs.open-metadata.org/public/images/connectors/glue.webp)

# Glue

PROD

In this section, we provide guides and references to use the Glue connector.
Configure and schedule Glue metadata and profiler workflows from the OpenMetadata UI:

* [Requirements](#requirements)
* [How Glue Maps to OpenMetadata](#how-glue-maps-to-openmetadata)
* [Metadata Ingestion](#metadata-ingestion)
* [dbt Integration](#dbt-integration)

## How to Run the Connector Externally

To run the Ingestion via the UI you'll need to use the OpenMetadata Ingestion Container, which comes shipped with
custom Airflow plugins to handle the workflow deployment.

If, instead, you want to manage your workflows externally on your preferred orchestrator, you can check
the following docs to run the Ingestion Framework **anywhere**.

> [card] [External Schedulers](https://docs.open-metadata.org/v2.1.x/deployment/ingestion.md)
>
> Get more information about running the Ingestion Framework Externally

## Requirements

The connector reads metadata from the AWS Glue Data Catalog through the AWS Glue API. Grant the following AWS Identity and Access Management (IAM) permissions to the AWS identity that the connector uses:

* `glue:GetDatabases`: Lists the Glue databases in the catalog.
* `glue:GetTables`: Lists the tables and views in each Glue database, with their columns.

Iceberg tables need no additional permissions. For more information, see [Iceberg Table Support](https://docs.open-metadata.org/v2.1.x/connectors/database/glue.md#iceberg-table-support).

The following policy grants these permissions on every database and table in the catalog. Replace `<AWS_REGION>` and `<ACCOUNT_ID>` with your values.

```json theme={null}
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "glue:GetDatabases",
        "glue:GetTables"
      ],
      "Resource": [
        "arn:aws:glue:<AWS_REGION>:<ACCOUNT_ID>:catalog",
        "arn:aws:glue:<AWS_REGION>:<ACCOUNT_ID>:database/*",
        "arn:aws:glue:<AWS_REGION>:<ACCOUNT_ID>:table/*/*"
      ]
    }
  ]
}
```

If AWS Lake Formation manages the catalog, also grant the identity the `DESCRIBE` permission on the databases and tables to ingest. Without that grant, Glue leaves those databases and tables out of its responses instead of returning an error.

### Python Requirements

Use Python 3.10 or later. Python 3.12 is recommended, because it is what the OpenMetadata 2.0 ingestion images use. To confirm the supported range for your release, check the `Requires-Python` metadata of that release’s `openmetadata-ingestion` package.

To run the Glue ingestion, you will need to install:

```bash theme={null}
pip3 install "openmetadata-ingestion[glue]"
```

## How Glue Maps to OpenMetadata

The connector doesn't map a Glue database to an OpenMetadata database. The Glue Data Catalog becomes the OpenMetadata database, and each Glue database becomes a schema inside it.

| AWS Glue | OpenMetadata | Name in OpenMetadata |
| - | - | - |
| Data Catalog | Database | The catalog ID (your AWS account ID, for example `123456789012`), unless you set `databaseName`. |
| Database | Schema | The Glue database name. |
| Table or view | Table | The Glue table name. Iceberg tables get the `Iceberg` table type, Delta Lake tables `DeltaLake`, external tables `External`, views `View`, and all other tables `Regular`. |

`databaseName` does more than rename the database. When you set it:

* The connector creates one database with that name and stops using `databaseFilterPattern` to select catalogs, so leave that pattern empty.
* Every Glue database the connector can see becomes a schema of that database, even when the Glue databases come from different catalogs. The ingestion run reports a warning when it sees more than one catalog.
* If two Glue databases from different catalogs share a name, one overwrites the other and its tables go missing.

To keep one database per catalog, leave `databaseName` unset. To choose which Glue databases to ingest, use `schemaFilterPattern`.

### Filter Patterns

Each filter pattern in `sourceConfig` matches the Glue name at its own level of this mapping. Patterns are case-insensitive regular expressions matched from the start of the name.

| Field | Matches | Matching example | Non-matching example |
| - | - | - | - |
| `databaseFilterPattern` | Catalog ID, when `databaseName` is unset | `^123456789012$` includes the catalog `123456789012`. | The same pattern skips the catalog `210987654321`. An include pattern that names a Glue database, such as `^sales$`, matches no catalog ID. The connector then skips the whole catalog. |
| `schemaFilterPattern` | Glue database name | `^sales_` includes the Glue database `sales_raw`. | The same pattern skips the Glue database `marketing_raw`. |
| `tableFilterPattern` | Glue table name | `^orders` includes the table `orders_2024`. | The same pattern skips the table `customer_orders`. |

The following `sourceConfig` applies these include patterns:

```yaml theme={null}
  sourceConfig:
    config:
      type: DatabaseMetadata
      databaseFilterPattern:
        includes:
          - "^123456789012$"
      schemaFilterPattern:
        includes:
          - "^sales_"
      tableFilterPattern:
        includes:
          - "^orders"
```

If a pattern contains only digits, such as `123456789012`, wrap it in quotes. Otherwise, YAML reads it as a number, and the workflow rejects it because filter patterns must be strings.

If you set `useFqnForFiltering: true`, patterns match the fully qualified name instead. For example, the Glue database `sales_raw` in the catalog `123456789012` of the service `local_glue` has the fully qualified name `local_glue.123456789012.sales_raw`.

## Metadata Ingestion

All connectors are defined as JSON Schemas.
[Here](https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-spec/src/main/resources/json/schema/entity/services/connections/database/glueConnection.json)
you can find the structure to create a connection to Glue.
In order to create and run a Metadata Ingestion workflow, we will follow
the steps to create a YAML configuration able to connect to the source,
process the Entities if needed, and reach the OpenMetadata server.
The workflow is modeled around the following
[JSON Schema](https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-spec/src/main/resources/json/schema/metadataIngestion/workflow.json)

### 1. Define the YAML Config

#### Source Configuration

Configure the source type and service name for your Glue connector.

#### AWS Configuration

AWS Access Key Credentials

**awsAccessKeyId** and **awsSecretAccessKey** are used to authenticate and authorize programmatic requests to AWS services.

An access key consists of:

* **Access Key ID** (for example, `AKIAIOSFODNN7EXAMPLE`)
* **Secret Access Key** (for example, `wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY`)

Both values must be provided together when using static credentials.

For more information, see
[Managing access keys](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).

AWS Session Token

**awsSessionToken** is required when using **temporary security credentials**, such as those obtained via AWS STS.

The session token must be provided along with the access key ID and secret access key for the duration of the session.

AWS Region

**awsRegion** specifies the AWS Region where the target service is deployed (for example, `us-east-1`).

This is the **only required parameter** when configuring an AWS connection. Other credentials can be resolved automatically using environment variables, AWS profiles, or IAM roles.

Learn more in the
[AWS Regions and Availability Zones documentation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html).

Custom Endpoint URL

**endPointURL** is an optional custom endpoint used to connect to an AWS service.

You may want to specify this when:

* Using VPC endpoints
* Connecting to local or AWS-compatible services
* Overriding the default regional endpoint

See
[AWS service endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html) for details.

AWS Profile Name

**profileName** specifies the AWS CLI profile to use for authentication.

Profiles store credentials and configuration in AWS config files.
If not specified, the `default` profile is used.

Learn more about
[Named profiles for the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html).

Assume Role ARN

**assumeRoleArn** is the Amazon Resource Name (ARN) of the IAM role to assume.

This is commonly used for:

* Cross-account access
* Delegated permissions
* Enhanced security setups

This field is **required** when using Assume Role authentication.

See the
[AssumeRole API reference](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).

Assume Role Session Name

**assumeRoleSessionName** identifies the assumed role session.

This value helps uniquely identify a session when the same role is assumed multiple times or by different principals.

If not provided, the default value `OpenMetadataSession` is used.

Assume Role Source Identity

**assumeRoleSourceIdentity** is an optional source identity passed when assuming a role.

This value is recorded in AWS CloudTrail logs and can be used to trace actions performed using the assumed role.

See
[Source Identity in AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html).

#### Database Name

**databaseName**: Optional name of a single OpenMetadata database that holds all your Glue databases. If you leave it blank, the connector creates one database per catalog and names it after the [catalog ID](https://docs.aws.amazon.com/glue/latest/dg/glue-specifying-resource-arns.html#data-catalog-resource-arns), which is your AWS account ID. Setting it also changes how catalogs are mapped and filtered. For more information, see [How Glue Maps to OpenMetadata](#how-glue-maps-to-openmetadata).

#### Connection Options

**Connection Options (Optional)**: Enter the details for any additional connection options that can be sent to database during the connection. These details must be added as Key-Value pairs.

#### Connection Arguments

**Connection Arguments (Optional)**: Enter the details for any additional connection arguments such as security or protocol configs that can be sent to database during the connection. These details must be added as Key-Value pairs.

* In case you are using Single-Sign-On (SSO) for authentication, add the `authenticator` details in the Connection Arguments as a Key-Value pair as follows: `"authenticator" : "sso_login_url"`

#### Source Config

The `sourceConfig` is defined [here](https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-spec/src/main/resources/json/schema/metadataIngestion/databaseServiceMetadataPipeline.json):

* **markDeletedTables**: To flag tables as soft-deleted if they are not present anymore in the source system.
* **markDeletedStoredProcedures**: Optional configuration to soft delete stored procedures in OpenMetadata if the source stored procedures are deleted. Also, if the stored procedure is deleted, all the associated entities like lineage, etc., with that stored procedure will be deleted.
* **markDeletedSchemas**: Optional configuration to soft delete schemas stored in OpenMetadata if the source schema is deleted. Setting this flag to true will only keep filtered schemas and delete any other schemas that do not match schemaFilterPattern or do not exist at source.
* **markDeletedDatabases**: Additional optional configuration for soft deletion, providing a granular option to select which particular entities should be deleted.
* **includeTables**: Set to `true` or `false` to ingest table data. Default is `true`.
* **includeViews**: Set to `true` or `false` to ingest view definitions.
* **includeTags**: Optional configuration to toggle the tags ingestion.
* **includeOwners**: Set the **Include Owners** toggle to control whether to include owners to the ingested entity if the owner email matches with a user stored in the OM server as part of metadata ingestion. If the ingested entity already exists and has an owner, the owner will not be overwritten.
* **ownerConfig**: Advanced, hierarchical configuration for assigning owners to databases, schemas, and tables during ingestion, with per-entity mappings and inheritance. For more information, see [Hierarchical Owner Configuration](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/hierarchical-owner-configuration).
* **includeStoredProcedures**: Optional configuration to toggle the Stored Procedures ingestion.
* **includeDDL**: Optional configuration to toggle the DDL Statements ingestion.
* **overrideMetadata** *(boolean)*: Set the **Override Metadata** toggle to control whether to override the existing metadata in the OpenMetadata server with the metadata fetched from the source. If the toggle is set to true, the metadata fetched from the source will override the existing metadata in the OpenMetadata server. If the toggle is set to false, the metadata fetched from the source will not override the existing metadata in the OpenMetadata server. This is applicable for fields like description, tags, owner, and displayName.
* **queryLogDuration**: Configuration to tune how far we want to look back in query logs to process Stored Procedures results.
* **queryParsingTimeoutLimit**: Configuration to set the timeout for parsing the query in seconds.
* **useFqnForFiltering**: Regex will be applied on the fully qualified name (for example, `service_name.db_name.schema_name.table_name`) instead of the raw name (for example, `table_name`).
* **databaseFilterPattern**, **schemaFilterPattern**: Note that the filter supports regex as include or exclude. You can find examples [here](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/filter-patterns/database).
* **tableFilterPattern**: Note that the filter supports regex as include or exclude. You can find examples [here](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/filter-patterns/table).
* **threads (beta)**: The number of threads to use when extracting the metadata using multithreading.
* **databaseMetadataConfigType** *(string)*: Database Source Config Metadata Pipeline type.
* **incremental (beta)**: Incremental Extraction configuration. Currently implemented for [BigQuery](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/incremental-extraction/bigquery), [Redshift](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/incremental-extraction/redshift), and [Snowflake](https://docs.open-metadata.org/connectors/ingestion/workflows/metadata/incremental-extraction/snowflake).

For Glue, `databaseFilterPattern` matches the catalog ID and `schemaFilterPattern` matches the Glue database name. For examples, see [Filter Patterns](#filter-patterns).

#### Sink Configuration

To send the metadata to OpenMetadata, it needs to be specified as `type: metadata-rest`.

#### Workflow Configuration

The main property here is `openMetadataServerConfig`, where you can define the host and security provider of your OpenMetadata installation.

* **loggerLevel**: Specify the logger level depending on your needs. If you are troubleshooting an ingestion, use `DEBUG` for more detailed traces.
* **JWT token**: JWT tokens allow clients to authenticate against the OpenMetadata server. See [Enable JWT Tokens](https://docs.open-metadata.org/deployment/security/enable-jwt-tokens) and [JWT Troubleshooting](https://docs.open-metadata.org/deployment/security/jwt-troubleshooting) for more information.
* **storeServiceConnection**: If set to `true` (default), sensitive information is stored encrypted with the Fernet Key or externally if you have configured a [Secrets Manager](https://docs.open-metadata.org/deployment/secrets-manager). If set to `false`, the service is created, but the service connection information is only used by the Ingestion Framework at runtime and is not sent to the OpenMetadata server.
* **SSL configuration**: If you have added SSL to the [OpenMetadata server](https://docs.open-metadata.org/deployment/security/enable-ssl), configure the certificates for ingestion. Set `verifySSL` to `ignore`, or set it to `validate` and provide `sslConfig.caCertificate` with a local path to the server certificate. See [SSL Troubleshooting](https://docs.open-metadata.org/deployment/security/enable-ssl/ssl-troubleshooting) for more information.
* **ingestionPipelineFQN**: Fully qualified name of the ingestion pipeline, used to identify the current ingestion pipeline.

glue\_config.yaml
Copy full code

```yaml theme={null}
source:
  type: glue
  serviceName: local_glue
  serviceConnection:
    config:
      type: Glue
      awsConfig:
      databaseName: database_name
      # connectionOptions:
      #   key: value
      # connectionArguments:
      #   key: value
```

```yaml theme={null}
         awsAccessKeyId: KEY
         awsSecretAccessKey: SECRET
```

```yaml theme={null}
        # awsSessionToken: TOKEN
```

```yaml theme={null}
         awsRegion: us-east-2
```

```yaml theme={null}
        # endPointURL: https://athena.us-east-2.amazonaws.com/custom
```

```yaml theme={null}
        # profileName: profile
```

```yaml theme={null}
        # assumeRoleArn: "arn:partition:service:region:account:resource"
```

```yaml theme={null}
        # assumeRoleSessionName: session
```

```yaml theme={null}
        # assumeRoleSourceIdentity: identity
```

```yaml theme={null}
  sourceConfig:
    config:
      type: DatabaseMetadata
      markDeletedTables: true
      markDeletedStoredProcedures: true
      markDeletedSchemas: true
      markDeletedDatabases: true
      includeTables: true
      includeViews: true
      # includeTags: true
      # includeOwners: false
      # ownerConfig:
      #   default: data-platform-team
      #   database:
      #     database1: owner1
      #   databaseSchema:
      #     database1.schema1: owner1
      #   table:
      #     database1.schema1.table1: owner1
      #   enableInheritance: true
      # includeStoredProcedures: true
      # includeDDL: true
      # overrideMetadata: false
      # queryLogDuration: 1
      # queryParsingTimeoutLimit: 300
      # useFqnForFiltering: false
      # threads: 1
      # databaseMetadataConfigType: ()
      # incremental:
      #   enabled: true
      #   lookbackDays: 7
      #   safetyMarginDays: 1
      # databaseFilterPattern:
      #   includes:
      #     - database1
      #     - database2
      #   excludes:
      #     - database3
      #     - database4
      # schemaFilterPattern:
      #   includes:
      #     - schema1
      #     - schema2
      #   excludes:
      #     - schema3
      #     - schema4
      # tableFilterPattern:
      #   includes:
      #     - users
      #     - type_test
      #   excludes:
      #     - table3
      #     - table4
```

```yaml theme={null}
sink:
  type: metadata-rest
  config: {}
```

```yaml theme={null}
workflowConfig:
  loggerLevel: INFO  # DEBUG, INFO, WARNING or ERROR
  openMetadataServerConfig:
    hostPort: "http://localhost:8585/api"
    authProvider: openmetadata
    securityConfig:
      jwtToken: "{bot_jwt_token}"
    ## Store the service Connection information
    storeServiceConnection: true  # false
    ## Secrets Manager Configuration
    # secretsManagerProvider: aws, azure or noop
    # secretsManagerLoader: airflow or env
    ## If SSL, fill the following
    # verifySSL: validate  # or ignore
    # sslConfig:
    #   caCertificate: /local/path/to/certificate
# ingestionPipelineFQN: <service name>.<ingestion name> ## e.g., "my_redshift.metadata"
```

### 2. Run with the CLI

First, we will need to save the YAML file. Afterward, and with all requirements installed, we can run:

```bash theme={null}
metadata ingest -c <path-to-yaml>
```

Note that from connector to connector, this recipe will always be the same. By updating the YAML configuration,
you will be able to extract metadata from different sources.

## dbt Integration

> [card] [dbt Integration](https://docs.open-metadata.org/v2.1.x/connectors/database/dbt.md)
>
> Learn more about how to ingest dbt models


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.