i have just installed apache airflow according to the following steps:
pip install "apache-airflow[celery, crypto, postgres, mysql, rabbitmq, redis]" --constraint constraints-3.7.txt
airflow db init
mkdir airflow/dags
- Set to False the
load_examples
variables at airflow.cfg file.
- Created a user.
I'm using a Ubuntu 16.04.6 LTS VM and a virtual enviroment with Python 3.7.8 installed.
~$ sqlite3 --version
3.11.0
>>> import sqlite3
>>> sqlite3.version
'2.6.0'
My dag inside the dags folder is the following:
from airflow import DAG
from airflow.operators.dummy_operator import DummyOperator
from airflow.operators.python_operator import PythonOperator
from time import sleep
from datetime import datetime
def print_hello():
sleep(5)
return 'Hello World'
with DAG('hello_world_dag', description='First DAG', schedule_interval='*/10 * * * *', start_date=datetime(2018, 11, 1), catchup=False) as dag:
dummy_task = DummyOperator(task_id='dummy_task', retries=3)
python_task = PythonOperator(task_id='python_task', python_callable=print_hello)
dummy_task >> python_task
At the execution dummy task runs perfectly, otherwise, python task throws this error:
[2020-12-31 12:23:27,493] {taskinstance.py:1396} ERROR - (sqlite3.OperationalError) near ",": syntax error
[SQL: DELETE FROM rendered_task_instance_fields WHERE rendered_task_instance_fields.dag_id = ? AND rendered_task_instance_fields.task_id = ? AND (rendered_task_instance_fields.dag_id, rendered_task_instance_fields.task_id, rendered_task_instance_fields.execution_date) NOT IN (SELECT rendered_task_instance_fields.dag_id, rendered_task_instance_fields.task_id, rendered_task_instance_fields.execution_date
FROM rendered_task_instance_fields
WHERE rendered_task_instance_fields.dag_id = ? AND rendered_task_instance_fields.task_id = ? ORDER BY rendered_task_instance_fields.execution_date DESC
LIMIT ? OFFSET ?)]
[parameters: ('hello_world_dag', 'python_task', 'hello_world_dag', 'python_task', 30, 0)]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
Traceback (most recent call last):
File "/home/vagrant/.sandbox/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context
cursor, statement, parameters, context
File "/home/vagrant/.sandbox/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: near ",": syntax error
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…