Boa noite, pessoal!
Estou com o problema abaixo ao tentar rodar o script
[2024-04-05 00:18:45,108] {connection.py:424} ERROR - Unable to retrieve connection from secrets backend (MetastoreBackend). Checking subsequent secrets backend.
Traceback (most recent call last):
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_context
self.dialect.do_execute(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 716, 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/heloisa/.local/lib/python3.10/site-packages/airflow/models/connection.py", line 420, in get_connection_from_secrets
conn = secrets_backend.get_connection(conn_id=conn_id)
File "/home/heloisa/.local/lib/python3.10/site-packages/airflow/utils/session.py", line 71, in wrapper
return func(*args, session=session, **kwargs)
File "/home/heloisa/.local/lib/python3.10/site-packages/airflow/secrets/metastore.py", line 36, in get_connection
conn = session.query(Connection).filter(Connection.conn_id == conn_id).first()
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2734, in first
return self.limit(1)._iter().first()
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/orm/query.py", line 2818, in _iter
result = self.session.execute(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/orm/session.py", line 1670, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1520, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 313, in _execute_on_connection
return connection._execute_clauseelement(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1389, in _execute_clauseelement
ret = self._execute_context(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1748, in _execute_context
self._handle_dbapi_exception(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1929, in _handle_dbapi_exception
util.raise_(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/util/compat.py", line 211, in raise_
raise exception
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/base.py", line 1705, in _execute_context
self.dialect.do_execute(
File "/home/heloisa/.local/lib/python3.10/site-packages/sqlalchemy/engine/default.py", line 716, 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: http://sqlalche.me/e/14/e3q8)
Traceback (most recent call last):
File "/home/heloisa/Documents/curso-airflow2/Airflow/hook/twitter_hook.py", line 71, in <module>
for pg in TwitterHook(end_time, start_time, query).run():
File "/home/heloisa/Documents/curso-airflow2/Airflow/hook/twitter_hook.py", line 57, in run
session = self.get_conn()
File "/home/heloisa/.local/lib/python3.10/site-packages/airflow/providers/http/hooks/http.py", line 68, in get_conn
conn = self.get_connection(self.http_conn_id)
File "/home/heloisa/.local/lib/python3.10/site-packages/airflow/hooks/base.py", line 67, in get_connection
conn = Connection.get_connection_from_secrets(conn_id)
File "/home/heloisa/.local/lib/python3.10/site-packages/airflow/models/connection.py", line 430, 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