Ainda não tem acesso? Estude com a gente! Matricule-se
Ainda não tem acesso? Estude com a gente! Matricule-se
4
respostas

Hook não funciona

Ja assisti dezenas de vezes a aula, ja reescrevi o codigo, ja formatei a maquina, ja fiz o que todos aqui ja sugeriram e nada faz o hook funcionar, sempre aparece erro de parametro... vou colcar um print do erro aqui, se alguem conseguir me ajudar eu agradeço.

obiwan@obiwan-VirtualBox:~/datapipeline/airflow/plugins/hooks$ python3 twitter_hook.py Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1276, in executecontext self.dialect.do_execute( File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 593, 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 "twitter_hook.py", line 59, in for pg in TwitterHook("AluraOnline").run(): File "twitter_hook.py", line 52, in run session = self.get_conn() File "/usr/local/lib/python3.8/dist-packages/airflow/hooks/http_hook.py", line 62, in get_conn conn = self.get_connection(self.http_conn_id) File "/usr/local/lib/python3.8/dist-packages/airflow/hooks/base_hook.py", line 87, in get_connection conn = random.choice(list(cls.get_connections(conn_id))) File "/usr/local/lib/python3.8/dist-packages/airflow/hooks/base_hook.py", line 83, in get_connections return secrets.get_connections(conn_id) File "/usr/local/lib/python3.8/dist-packages/airflow/secrets/init.py", line 55, in get_connections conn_list = secrets_backend.get_connections(conn_id=conn_id) File "/usr/local/lib/python3.8/dist-packages/airflow/utils/db.py", line 74, in wrapper return func(args, *kwargs) File "/usr/local/lib/python3.8/dist-packages/airflow/secrets/metastore.py", line 35, in get_connections conn_list = session.query(Connection).filter(Connection.conn_id == conn_id).all() File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3373, in all return list(self) File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3535, in iter return self.executeand_instances(context) File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/orm/query.py", line 3560, in executeand_instances result = conn.execute(querycontext.statement, self.params) File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1011, in execute return meth(self, multiparams, params) File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/sql/elements.py", line 298, in _executeon_connection return connection.executeclauseelement(self, multiparams, params) File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1124, in executeclauseelement ret = self.executecontext( File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1316, in executecontext self.handledbapi_exception( File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1510, in handledbapi_exception util.raise_( File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/base.py", line 1276, in executecontext self.dialect.do_execute( File "/usr/local/lib/python3.8/dist-packages/sqlalchemy/engine/default.py", line 593, 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.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 = ?] [parameters: ('twitter_default',)] (Background on this error at: http://sqlalche.me/e/13/e3q8)

4 respostas

Também estou tendo problema nessa parte!

Você criou a conexão twitter_default no Airflow?

Cara, me perdoe... olha o erro que apresentei e se for possivel me apresente onde estou errando...

estou idem travado no mesmo erro aqui...

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software