[英]Why do I get no such table error when installing Apache Airflow on Mac?
It was so hard to put that right title.很难给出正确的标题。 Ok, here it goes.
好的,就到这里了。 I was following this tutorial to install Apache Airflow on my Mac (Mojave version) -
我正在按照本教程在我的 Mac(Mojave 版本)上安装 Apache Airflow -
https://towardsdatascience.com/getting-started-with-apache-airflow-df1aa77d7b1b https://towardsdatascience.com/getting-started-with-apache-airflow-df1aa77d7b1b
Right at the first step after performing the pip install airflow task, when I run the airflow version command I am getting the following error and then the airflow version appears -在执行 pip install 气流任务后的第一步,当我运行气流版本命令时,我收到以下错误,然后出现气流版本 -
ERROR - Failed on pre-execution callback using Traceback (most recent call last): File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context cursor, statement, parameters, context File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) sqlite3.OperationalError: no such table: log
错误 - 使用 Traceback 执行前回调失败(最近一次调用最后一次):文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py”,第 1244 行,在 _execute_context游标、语句、参数、上下文 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/default.py”,第 552 行,在 do_execute cursor.execute(statement, parameters) sqlite3 中。 OperationalError:没有这样的表:日志
The above exception was the direct cause of the following exception:上述异常是以下异常的直接原因:
Traceback (most recent call last): File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/cli_action_loggers.py", line 68, in on_pre_execution cb(**kwargs) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/cli_action_loggers.py", line 99, in default_action_log session.add(log) File "/Users/karthikv/anaconda3/lib/python3.7/contextlib.py", line 119, in exit next(self.gen) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/db.py", line 45, in create_session session.commit() File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 1026, in commit self.transaction.commit() File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 493, in commit self._prepare_impl() File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 472, in _prepare_impl self.session.flush() File "/Users/karthikv/anaconda3/lib/python3.7/site-package
回溯(最近一次通话):文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/cli_action_loggers.py”,第 68 行,在 on_pre_execution cb(**kwargs) 文件“/ Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/cli_action_loggers.py”,第 99 行,在 default_action_log session.add(log) 文件中“/Users/karthikv/anaconda3/lib/python3.7 /contextlib.py”,第 119 行,在退出next(self.gen) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/airflow/utils/db.py”,第 45 行,在 create_session session.commit() 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py”,第 1026 行,提交 self.transaction.commit() 文件“/Users/ karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py”,第 493 行,提交 self._prepare_impl() 文件“/Users/karthikv/anaconda3/lib/python3.7/site-包/sqlalchemy/orm/session.py”,第 472 行,在 _prepare_impl self.session.flush() 文件“/Users/karthikv/anaconda3/lib/python3.7/site-package s/sqlalchemy/orm/session.py", line 2451, in flush self._flush(objects) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2589, in _flush transaction.rollback(_capture_exception=True) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py", line 68, in exit compat.reraise(exc_type, exc_value, exc_tb) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 129, in reraise raise value File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py", line 2549, in _flush flush_context.execute() File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 422, in execute rec.execute(self) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py", line 589, in execute uow, File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 245, in save_obj inser
s/sqlalchemy/orm/session.py”,第 2451 行,刷新 self._flush(objects) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/session.py”,第 2589 行,在 _flush transaction.rollback(_capture_exception=True) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/util/langhelpers.py”中,第 68 行,在退出compat.reraise( exc_type, exc_value, exc_tb) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py”,第 129 行,在重新提高价值文件“/Users/karthikv/anaconda3/ lib/python3.7/site-packages/sqlalchemy/orm/session.py”,第 2549 行,在 _flush flush_context.execute() 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/ orm/unitofwork.py”,第 422 行,在执行 rec.execute(self) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/unitofwork.py”,第 589 行,在执行 uow,文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py”,第 245 行,在 save_obj 插入器中t, File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py", line 1120, in _emit_insert_statements statement, params File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement distilled_params, File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context e, statement, parameters, cursor, context File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) File "/Users/karthikv/an
t,文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/orm/persistence.py”,第 1120 行,在 _emit_insert_statements 语句中,参数文件“/Users/karthikv/anaconda3/lib/python3 .7/site-packages/sqlalchemy/engine/base.py", line 988, in execute return meth(self, multiparams, params) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy /sql/elements.py”,第 287 行,在 _execute_on_connection 中返回 connection._execute_clauseelement(self, multiparams, params) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py “,第 1107 行,在 _execute_clauseelement distilled_params,文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py”,第 1248 行,在 _execute_context e、语句、参数、光标、上下文文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py”,第 1466 行,在 _handle_dbapi_exception util.raise_from_cause(sqlalchemy_exception, exc_info) 文件“/Users/karthikv/an aconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise raise value.with_traceback(tb) File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context cursor, statement, parameters, context File "/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 552, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: log [SQL: INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, extra) VALUES (?, ?, ?, ?, ?, ?, ?)] [parameters: ('2019-08-12 20:50:24.960006', None, None, 'cli_version', None, 'karthikv', '{"host_name": "192-168-1-6.tpgi.com.au", "full_command": "[\\'/Users/karthikv/anaconda3/bin/airflow\\', \\'version\\'
aconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) 文件“/Users/karthikv/ anaconda3/lib/python3.7/site-packages/sqlalchemy/util/compat.py”,第 128 行,重新加注提高 value.with_traceback(tb) 文件“/Users/karthikv/anaconda3/lib/python3.7/site-包/sqlalchemy/engine/base.py”,第 1244 行,在 _execute_context 游标、语句、参数、上下文文件“/Users/karthikv/anaconda3/lib/python3.7/site-packages/sqlalchemy/engine/default.py” ,第 552 行,在 do_execute cursor.execute(statement, parameters) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: log [SQL: INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, extra ) VALUES (?, ?, ?, ?, ?, ?, ?)] [参数: ('2019-08-12 20:50:24.960006', None, None, 'cli_version', None, 'karthikv', ' {"host_name": "192-168-1-6.tpgi.com.au", "full_command": "[\\'/Users/karthikv/anaconda3/bin/airflow\\', \\'version\\' ]"}')]
]"}')]
(Background on this error at: http://sqlalche.me/e/e3q8 ) (此错误的背景: http : //sqlalche.me/e/e3q8 )
Can someone help me what this error means and how to solve it?有人可以帮助我这个错误意味着什么以及如何解决它? I understand from the instructions that by default SQLLite db gets installed and a single DAG restrictions would be in place before we get into setting up backend database say PostgreSQL.
我从说明中了解到,默认情况下会安装 SQLLite db,并且在我们开始设置后端数据库(例如 PostgreSQL)之前,将设置单个 DAG 限制。
I tried to uninstall using pip uninstall airflow to perform clean installation again.我尝试使用pip卸载气流卸载以再次执行全新安装。 I get the following error -
我收到以下错误 -
WARNING: Skipping airflow as it is not installed.
警告:跳过气流,因为它没有安装。
Kindly help me in solving the issue (or) pointing me to resources where I can do further reading.请帮助我解决问题(或)指向我可以进一步阅读的资源。
You need to perform initialization after installation:安装后需要进行初始化:
$ export AIRFLOW_HOME=some/dir
$ airflow db init # or `airflow initdb` for the legacy 1.X
If AIRFLOW_HOME
is unset, ~/airflow/
will be created and used.如果
AIRFLOW_HOME
未设置, ~/airflow/
AIRFLOW_HOME
~/airflow/
将被创建和使用。 This is where the config and logs will be stored;这是存储配置和日志的地方; if you want to reset the configuration, remove the dir stored in
AIRFLOW_HOME
and rerun airflow db init
.如果要重置配置,请删除存储在
AIRFLOW_HOME
中的目录并重新运行AIRFLOW_HOME
airflow db init
。
Now other commands should work, eg现在其他命令应该可以工作,例如
$ airflow db check
[2021-02-06 23:35:21,577] {db.py:756} INFO - Connection successful.
Source: Initializing Airflow Database section from airflow
docs.来源:来自
airflow
文档的初始化气流数据库部分。 Kudos to Anas Tiour who notified about the command line interface change in 2.0.0 in this comment !感谢 Anas Tiour ,他在此评论中通知了 2.0.0 中的命令行界面更改!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.