OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Connections arguments not respected while adding Airflow with a non-default DB schema as a pipeline service

Open teabbs opened this issue 1 year ago • 1 comments

Affected module Mostly it affects the Ingestion Framework, but the parameters are set in the UI.

Describe the bug We use a remote instance of Airflow as a metadata source (pipeline service). The issue is that it has its tables in a non-default schema (airflow_meta instead of public), and selecting eg FROM serialized_dag gives a table doesn't exist error on the stage PipelineDetailsAccess of testing connection. The remote DB is PostgreSQL. Manually selecting FROM airflow_meta.serialized_dag is successful. In OM 1.5.10 we used a connection argument 'options':'-c search_path=airflow_meta', and it solved the problem. But after and ugrade to OM 1.7.5 it stopped working again with the same error. Both postgresql+psycopg2 and pgspider+psycopg2 connection schemes give the same result.

To Reproduce Place Airflow tables in a non-default schema - in other than public and leave it as default or leave it in public and make another schema the default. Connect this Airflow instance as a service adding the search_path for the needed schema. Try to run ingestion.

Expected behavior The search_path argument is respected and used for all requests to the DB.

Version:

  • OS: Oracle Linux 8.5
  • Python version: 3.11
  • OpenMetadata version: 1.7.5
  • OpenMetadata Ingestion package version: openmetadata-ingestion[Airflow]==1.7.5
  • The remote Airflow DB: PostgreSQL 15.6
  • SqlAlchemy: 1.4.54

Additional context On my own I was able to trace the error to the session.query() line of the test_connection block. In 1.5.10 it didn't use such ORM query, but rather a more direct call to engine. Maybe this way SqlAlchemy fails to apply connection arguments passed from connection settings.

teabbs avatar Jul 29 '25 12:07 teabbs

Hi @teabbs, could you please try with the latest version of OpenMetadata? I was able to make it work using the connection arguments you shared in the ticket. options: -c search_path=airflow_meta

keshavmohta09 avatar Mar 29 '26 21:03 keshavmohta09