Esse curso está impraticável, nenhuma aula se fizer exatamente o que o professor passa funciona, tudo tem que vir no fórum e garimpar para conseguir funcionar. Infelizmente cheguei há um ponto que não consigo mais resolver que é o problema com o "gancho" twitter_hooks. Ví varias postagens aqui e procurei no stackoverflow e não consigo fazer funcionar.
[2022-09-02 13:31:38,080] {connection.py:424} ERROR - Unable to retrieve connection from secrets backend (MetastoreBackend). Checking subsequent secrets backend.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 732, 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 "/usr/local/lib/python3.10/dist-packages/airflow/models/connection.py", line 420, in get_connection_from_secrets
conn = secrets_backend.get_connection(conn_id=conn_id)
File "/usr/local/lib/python3.10/dist-packages/airflow/utils/session.py", line 71, in wrapper
return func(*args, session=session, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/airflow/secrets/metastore.py", line 36, in get_connection
conn = session.query(Connection).filter(Connection.conn_id == conn_id).first()
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/query.py", line 2823, in first
return self.limit(1)._iter().first()
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/query.py", line 2907, in _iter
result = self.session.execute(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/orm/session.py", line 1712, in execute
result = conn._execute_20(statement, params or {}, execution_options)
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1705, in _execute_20
return meth(self, args_10style, kwargs_10style, execution_options)
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/sql/elements.py", line 333, in _execute_on_connection
return connection._execute_clauseelement(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1572, in _execute_clauseelement
ret = self._execute_context(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1943, in _execute_context
self._handle_dbapi_exception(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
util.raise_(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/util/compat.py", line 208, in raise_
raise exception
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/base.py", line 1900, in _execute_context
self.dialect.do_execute(
File "/usr/local/lib/python3.10/dist-packages/sqlalchemy/engine/default.py", line 732, 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/matheus/Estudos/helloworld/datapipeline/airflow/plugins/twitter_hooks.py", line 59, in <module>
for pg in TwitterHook("AluraOnline").run():
File "/home/matheus/Estudos/helloworld/datapipeline/airflow/plugins/twitter_hooks.py", line 52, in run
session = self.get_conn()
File "/usr/local/lib/python3.10/dist-packages/airflow/providers/http/hooks/http.py", line 82, in get_conn
conn = self.get_connection(self.http_conn_id)
File "/usr/local/lib/python3.10/dist-packages/airflow/hooks/base.py", line 67, in get_connection
conn = Connection.get_connection_from_secrets(conn_id)
File "/usr/local/lib/python3.10/dist-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