Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

erro ao executar o twitter_operator

Estou na aula 3 no segundo video e ao testar a classe operator o seguinte erro acontece:

python twitter_operator.py Traceback (most recent call last): File "twitter_operator.py", line 59, in ti.run() File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/utils/db.py", line 74, in wrapper return func(args, **kwargs) File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 1102, in run self.runraw_task( File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/utils/db.py", line 70, in wrapper return func(args, **kwargs) File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/models/taskinstance.py", line 984, in runraw_task result = task_copy.execute(context=context) File "twitter_operator.py", line 47, in execute for pg in hook.run(): File "/Users/fabiomoreira/Documents/alura/datapipeline/airflow/plugins/operators/twitter_hook.py", line 52, in run session = self.get_conn() File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/hooks/http_hook.py", line 62, in get_conn conn = self.get_connection(self.http_conn_id) File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/hooks/base_hook.py", line 87, in get_connection conn = random.choice(list(cls.get_connections(conn_id))) File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/hooks/base_hook.py", line 83, in get_connections return secrets.get_connections(conn_id) File "/Users/fabiomoreira/Documents/alura/datapipeline/.env/lib/python3.8/site-packages/airflow/secrets/init.py", line 59, in get_connections raise AirflowException("The conn_id {0} isn't defined".format(conn_id)) airflow.exceptions.AirflowException: The conn_id twitter_default isn't defined

1 resposta
solução!

Ola Fabio, Voce precisa criar a conexão twitter_default no airflow. É só inciar o airflow webserver e criar uma nova conexão na tela de connections.