You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The installation seems to work fine with sqlite, but the initial test fails: airflow tasks test example_bash_operator runme_0 2015-01-01
With the following error: sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'dag_run_note.user_id' could not find table 'ab_user' with which to generate a foreign key to target column 'id'
Here's the full output
(venv) ➜ airflow tasks test example_bash_operator runme_0 2015-01-01[2023-09-07T12:52:30.793-0500] {dagbag.py:539} INFO - Filling up the DagBag from /Users/thfalgou/tmp/airflow/dags[2023-09-07T12:52:30.899-0500] {example_local_kubernetes_executor.py:39} WARNING - Could not import DAGs in example_local_kubernetes_executor.pyTraceback (most recent call last): File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/example_dags/example_local_kubernetes_executor.py", line 37, in <module> from kubernetes.client import models as k8sModuleNotFoundError: No module named 'kubernetes'[2023-09-07T12:52:30.899-0500] {example_local_kubernetes_executor.py:40} WARNING - Install Kubernetes dependencies with: pip install apache-airflow[cncf.kubernetes][2023-09-07T12:52:31.259-0500] {example_kubernetes_executor.py:38} WARNING - The example_kubernetes_executor example DAG requires the kubernetes provider. Please install it with: pip install apache-airflow[cncf.kubernetes][2023-09-07T12:52:31.452-0500] {workday.py:36} WARNING - Could not import pandas. Holidays will not be considered./Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/cli/commands/task_command.py:190 RemovedIn20Warning: [31mDeprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. [32mTo prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". [36mSet environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings. Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message.[0m (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)[2023-09-07T12:52:31.645-0500] {taskinstance.py:1159} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: example_bash_operator.runme_0 __airflow_temporary_run_2023-09-07T17:52:31.464217+00:00__ [None]>
[2023-09-07T12:52:31.650-0500] {taskinstance.py:1159} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: example_bash_operator.runme_0 __airflow_temporary_run_2023-09-07T17:52:31.464217+00:00__ [None]>
[2023-09-07T12:52:31.650-0500] {taskinstance.py:1361} INFO - Starting attempt 1 of 1[2023-09-07T12:52:31.651-0500] {taskinstance.py:1430} WARNING - cannot record queued_duration for task runme_0 because previous state change time has not been saved[2023-09-07T12:52:31.651-0500] {taskinstance.py:1382} INFO - Executing <Task(BashOperator): runme_0> on 2015-01-01T00:00:00+00:00[2023-09-07T12:52:31.708-0500] {taskinstance.py:1660} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='airflow' AIRFLOW_CTX_DAG_ID='example_bash_operator' AIRFLOW_CTX_TASK_ID='runme_0' AIRFLOW_CTX_EXECUTION_DATE='2015-01-01T00:00:00+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='__airflow_temporary_run_2023-09-07T17:52:31.464217+00:00__'[2023-09-07T12:52:31.782-0500] {subprocess.py:63} INFO - Tmp dir root location: /var/folders/9k/7yh_q4xs7wj705jn0vrk_2yr0000gn/T[2023-09-07T12:52:31.783-0500] {subprocess.py:75} INFO - Running command: ['/bin/bash', '-c', 'echo "example_bash_operator__runme_0__20150101" && sleep 1'][2023-09-07T12:52:31.790-0500] {subprocess.py:86} INFO - Output:[2023-09-07T12:52:31.796-0500] {subprocess.py:93} INFO - example_bash_operator__runme_0__20150101[2023-09-07T12:52:32.808-0500] {subprocess.py:97} INFO - Command exited with return code 0[2023-09-07T12:52:32.838-0500] {taskinstance.py:1400} INFO - Marking task as SUCCESS. dag_id=example_bash_operator, task_id=runme_0, execution_date=20150101T000000, start_date=, end_date=20230907T175232Traceback (most recent call last): File "/Users/thfalgou/tmp/airflow/venv/bin/airflow", line 8, in <module> sys.exit(main()) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/__main__.py", line 60, in main args.func(args) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/cli/cli_config.py", line 49, in command return func(*args, **kwargs) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/utils/cli.py", line 113, in wrapper return f(*args, **kwargs) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/cli/commands/task_command.py", line 634, in task_test session.delete(ti.dag_run) File "/usr/local/Cellar/[email protected]/3.9.18/Frameworks/Python.framework/Versions/3.9/lib/python3.9/contextlib.py", line 126, in __exit__ next(self.gen) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/airflow/utils/session.py", line 37, in create_session session.commit() File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1454, in commit self._transaction.commit(_to_root=self.future) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 832, in commit self._prepare_impl() File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 811, in _prepare_impl self.session.flush() File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3449, in flush self._flush(objects) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3589, in _flush transaction.rollback(_capture_exception=True) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 70, in __exit__ compat.raise_( File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_ raise exception File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 3549, in _flush flush_context.execute() File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 456, in execute rec.execute(self) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/unitofwork.py", line 667, in execute util.preloaded.orm_persistence.delete_obj( File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/persistence.py", line 330, in delete_obj table_to_mapper = base_mapper._sorted_tables File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 1184, in __get__ obj.__dict__[self.__name__] = result = self.fget(obj) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/mapper.py", line 3386, in _sorted_tables sorted_ = sql_util.sort_tables( File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 1217, in sort_tables for (t, fkcs) in sort_tables_and_constraints( File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 1289, in sort_tables_and_constraints filtered = filter_fn(fkc) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/sql/ddl.py", line 1207, in _skip_fn if skip_fn(fk): File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/orm/mapper.py", line 3369, in skip dep = table_to_mapper.get(fk.column.table) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/util/langhelpers.py", line 1113, in __get__ obj.__dict__[self.__name__] = result = self.fget(obj) File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 2532, in column return self._resolve_column() File "/Users/thfalgou/tmp/airflow/venv/lib/python3.9/site-packages/sqlalchemy/sql/schema.py", line 2543, in _resolve_column raise exc.NoReferencedTableError(sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'dag_run_note.user_id' could not find table 'ab_user' with which to generate a foreign key to target column 'id'
Solving the problem
There appear to be two issues:
ModuleNotFoundError: No module named 'kubernetes'. This appears to be just a warning, but could be fixed in the CONSTRAINT_URL generator.
Foreign key associated with column 'dag_run_note.user_id' could not find table 'ab_user' with which to generate a foreign key to target column 'id'. This appears to be due to an issue with the schema and leads the user to believe that there's an issue. As a new user, this is very confusing and has me think there's something wrong in my setup or Apache Airflow
Anything else
I've encountered this both times I've run through the Quickstart. I've deleted the $AIRFLOW_HOME directory and tried again, with the same issue.
Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
I'm open and willing to; however, I don't know where even to start as I'm just doing this for a quick demonstration to other architects for how/why we should investigate Airflow.
I've checked that this error not affect 2.6.3, so you could get started with this version and after also check other samples, e.g. upgrade Airflow version.
What do you see as an issue?
I'm following https://airflow.apache.org/docs/apache-airflow/stable/start.html
The installation seems to work fine with sqlite, but the initial test fails:
airflow tasks test example_bash_operator runme_0 2015-01-01
With the following error:
sqlalchemy.exc.NoReferencedTableError: Foreign key associated with column 'dag_run_note.user_id' could not find table 'ab_user' with which to generate a foreign key to target column 'id'
Here's the full output
Solving the problem
There appear to be two issues:
ModuleNotFoundError: No module named 'kubernetes'
. This appears to be just a warning, but could be fixed in the CONSTRAINT_URL generator.Foreign key associated with column 'dag_run_note.user_id' could not find table 'ab_user' with which to generate a foreign key to target column 'id'
. This appears to be due to an issue with the schema and leads the user to believe that there's an issue. As a new user, this is very confusing and has me think there's something wrong in my setup or Apache AirflowAnything else
I've encountered this both times I've run through the Quickstart. I've deleted the $AIRFLOW_HOME directory and tried again, with the same issue.
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: