OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Ingesting MySQL via the UI results in failed Airflow task due to MySQLConfig Error

Open juliarvalenti opened this issue 4 years ago • 2 comments

Hello,

https://user-images.githubusercontent.com/42276144/150373085-9ba805f0-da28-49f6-856b-3e5bd2dfe86d.mov

In the above video, I am using the UI to create a new Ingestion. It immediately fails. The error that is given in the Airflow logs is that there is a validation error in the MySQL Config that filter_pattern is an "extra field"

I am on v0.7.0

*** Reading local file: /airflow/logs/my_ingest_3/my_ingest_3/2022-01-20T00:05:00+00:00/1.log
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1035} INFO - Dependencies all met for <TaskInstance: my_ingest_3.my_ingest_3 scheduled__2022-01-20T00:05:00+00:00 [queued]>
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1035} INFO - Dependencies all met for <TaskInstance: my_ingest_3.my_ingest_3 scheduled__2022-01-20T00:05:00+00:00 [queued]>
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1241} INFO - 
--------------------------------------------------------------------------------
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1242} INFO - Starting attempt 1 of 1
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1243} INFO - 
--------------------------------------------------------------------------------
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1262} INFO - Executing <Task(PythonOperator): my_ingest_3> on 2022-01-20 00:05:00+00:00
[2022-01-20, 15:42:20 UTC] {standard_task_runner.py:52} INFO - Started process 37826 to run task
[2022-01-20, 15:42:20 UTC] {standard_task_runner.py:76} INFO - Running: ['airflow', 'tasks', 'run', 'my_ingest_3', 'my_ingest_3', 'scheduled__2022-01-20T00:05:00+00:00', '--job-id', '108', '--raw', '--subdir', 'DAGS_FOLDER/my_ingest_3.py', '--cfg-path', '/tmp/tmp_weaex3w', '--error-file', '/tmp/tmpkk8q_qxu']
[2022-01-20, 15:42:20 UTC] {standard_task_runner.py:77} INFO - Job 108: Subtask my_ingest_3
[2022-01-20, 15:42:20 UTC] {logging_mixin.py:109} INFO - Running <TaskInstance: my_ingest_3.my_ingest_3 scheduled__2022-01-20T00:05:00+00:00 [running]> on host 5f7d0d56251d
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1427} INFO - Exporting the following env vars:
AIRFLOW_CTX_DAG_OWNER=airflow
AIRFLOW_CTX_DAG_ID=my_ingest_3
AIRFLOW_CTX_TASK_ID=my_ingest_3
AIRFLOW_CTX_EXECUTION_DATE=2022-01-20T00:05:00+00:00
AIRFLOW_CTX_DAG_RUN_ID=scheduled__2022-01-20T00:05:00+00:00
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1703} ERROR - Task failed with exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1332, in _run_raw_task
    self._execute_task_with_callbacks(context)
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1458, in _execute_task_with_callbacks
    result = self._execute_task(context, self.task)
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1514, in _execute_task
    result = execute_callable(context=context)
  File "/usr/local/lib/python3.9/site-packages/airflow/operators/python.py", line 151, in execute
    return_value = self.execute_callable()
  File "/usr/local/lib/python3.9/site-packages/airflow/operators/python.py", line 162, in execute_callable
    return self.python_callable(*self.op_args, **self.op_kwargs)
  File "/airflow/dag_managed_operators/metadata_ingestion.py", line 5, in metadata_ingestion_workflow
    workflow = Workflow.create(kwargs['workflow_config'])
  File "/ingestion/src/metadata/ingestion/api/workflow.py", line 150, in create
    return cls(config)
  File "/ingestion/src/metadata/ingestion/api/workflow.py", line 68, in __init__
    self.source: Source = source_class.create(
  File "/ingestion/src/metadata/ingestion/source/mysql.py", line 31, in create
    config = MySQLConfig.parse_obj(config_dict)
  File "pydantic/main.py", line 578, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for MySQLConfig
filter_pattern
  extra fields not permitted (type=value_error.extra)
[2022-01-20, 15:42:20 UTC] {taskinstance.py:1270} INFO - Marking task as FAILED. dag_id=my_ingest_3, task_id=my_ingest_3, execution_date=20220120T000500, start_date=20220120T154220, end_date=20220120T154220
[2022-01-20, 15:42:20 UTC] {standard_task_runner.py:88} ERROR - Failed to execute job 108 for task my_ingest_3
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/airflow/task/task_runner/standard_task_runner.py", line 85, in _start_by_fork
    args.func(args, dag=self.dag)
  File "/usr/local/lib/python3.9/site-packages/airflow/cli/cli_parser.py", line 48, in command
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/airflow/utils/cli.py", line 92, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py", line 292, in task_run
    _run_task_by_selected_method(args, dag, ti)
  File "/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py", line 107, in _run_task_by_selected_method
    _run_raw_task(args, ti)
  File "/usr/local/lib/python3.9/site-packages/airflow/cli/commands/task_command.py", line 180, in _run_raw_task
    ti._run_raw_task(
  File "/usr/local/lib/python3.9/site-packages/airflow/utils/session.py", line 70, in wrapper
    return func(*args, session=session, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1332, in _run_raw_task
    self._execute_task_with_callbacks(context)
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1458, in _execute_task_with_callbacks
    result = self._execute_task(context, self.task)
  File "/usr/local/lib/python3.9/site-packages/airflow/models/taskinstance.py", line 1514, in _execute_task
    result = execute_callable(context=context)
  File "/usr/local/lib/python3.9/site-packages/airflow/operators/python.py", line 151, in execute
    return_value = self.execute_callable()
  File "/usr/local/lib/python3.9/site-packages/airflow/operators/python.py", line 162, in execute_callable
    return self.python_callable(*self.op_args, **self.op_kwargs)
  File "/airflow/dag_managed_operators/metadata_ingestion.py", line 5, in metadata_ingestion_workflow
    workflow = Workflow.create(kwargs['workflow_config'])
  File "/ingestion/src/metadata/ingestion/api/workflow.py", line 150, in create
    return cls(config)
  File "/ingestion/src/metadata/ingestion/api/workflow.py", line 68, in __init__
    self.source: Source = source_class.create(
  File "/ingestion/src/metadata/ingestion/source/mysql.py", line 31, in create
    config = MySQLConfig.parse_obj(config_dict)
  File "pydantic/main.py", line 578, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 406, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 1 validation error for MySQLConfig
filter_pattern
  extra fields not permitted (type=value_error.extra)
[2022-01-20, 15:42:20 UTC] {local_task_job.py:154} INFO - Task exited with return code 1
[2022-01-20, 15:42:20 UTC] {local_task_job.py:264} INFO - 0 downstream tasks scheduled from follow-on schedule check

juliarvalenti avatar Jan 20 '22 15:01 juliarvalenti

I'd have to guess that this is probably related to this previous bug I submitted: https://github.com/open-metadata/OpenMetadata/issues/1826

But since this is done all through the UI, I'm not sure what I can do to get this to work without changing the code.

juliarvalenti avatar Jan 20 '22 16:01 juliarvalenti

I exec'd into the openmetadata/ingestion docker container and changed my json config in /airflow/dag_generated_configs to be "table_filter_pattern" instead of "filter_pattern" and reran the DAG via the UI and it seems to be working now, so this confirms that the logic is creating a config with the old "filter_pattern" key instead of the new "table_filter_pattern" key.

juliarvalenti avatar Jan 20 '22 16:01 juliarvalenti