O seguinte erro está aparecendo:
[2023-05-30T10:49:07.443-0300] {connection.py:428} ERROR - Unable to retrieve connection from secrets backend (MetastoreBackend). Checking subsequent secrets backend.
Traceback (most recent call last):
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1905, in _execute_context
self.dialect.do_execute(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: connection
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/models/connection.py", line 424, in get_connection_from_secrets
conn = secrets_backend.get_connection(conn_id=conn_id)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/utils/session.py", line 76, in wrapper
return func(*args, session=session, **kwargs)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/secrets/metastore.py", line 41, in get_connection
conn = session.query(Connection).filter(Connection.conn_id == conn_id).first()
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2824, in first
return self.limit(1)._iter().first()
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/orm/query.py", line 2916, in _iter
result = self.session.execute(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1717, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1710, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/sql/elements.py", line 334, in _execute_on_connection
return connection._execute_clauseelement(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1577, in _execute_clauseelement
ret = self._execute_context(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1948, in _execute_context
self._handle_dbapi_exception(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2129, in _handle_dbapi_exception
util.raise_(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1905, in _execute_context
self.dialect.do_execute(
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 736, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: connection
[SQL: SELECT connection.password AS connection_password, connection.extra AS connection_extra, connection.id AS connection_id, connection.conn_id AS connection_conn_id, connection.conn_type AS connection_conn_type, connection.description AS connection_description, connection.host AS connection_host, connection.schema AS connection_schema, connection.login AS connection_login, connection.port AS connection_port, connection.is_encrypted AS connection_is_encrypted, connection.is_extra_encrypted AS connection_is_extra_encrypted
FROM connection
WHERE connection.conn_id = ?
LIMIT ? OFFSET ?]
[parameters: ('twitter_default', 1, 0)]
(Background on this error at: https://sqlalche.me/e/14/e3q8)
Traceback (most recent call last):
File "/home/poletto/Documents/CURSO1/airflow_pipeline/hook/twitter_hook.py", line 70, in <module>
for pg in TwitterHook (end_time, start_time, query).run():
File "/home/poletto/Documents/CURSO1/airflow_pipeline/hook/twitter_hook.py", line 57, in run
session = self.get_conn()
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/providers/http/hooks/http.py", line 100, in get_conn
conn = self.get_connection(self.http_conn_id)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/hooks/base.py", line 72, in get_connection
conn = Connection.get_connection_from_secrets(conn_id)
File "/home/poletto/Documents/CURSO1/venv/lib/python3.9/site-packages/airflow/models/connection.py", line 434, in get_connection_from_secrets
raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
airflow.exceptions.AirflowNotFoundException: The conn_id `twitter_default` isn't defined