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

sqlite3.OperationalError: no such table: connection

Estou encontrando o erro abaixo, não sei identificar o que aconteceu nesse texto todo. Utilizei o código do git copiado...


Traceback (most recent call last):
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-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 <module>
    for pg in TwitterHook("AluraOnline").run():
  File "twitter_hook.py", line 52, in run
    session = self.get_conn()
  File "/home/lucas/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 "/home/lucas/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 "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/airflow/hooks/base_hook.py", line 83, in get_connections
    return secrets.get_connections(conn_id)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/airflow/secrets/__init__.py", line 55, in get_connections
    conn_list = secrets_backend.get_connections(conn_id=conn_id)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/airflow/utils/db.py", line 74, in wrapper
    return func(*args, **kwargs)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/airflow/secrets/metastore.py", line 35, in get_connections
    conn_list = session.query(Connection).filter(Connection.conn_id == conn_id).all()
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3373, in all
    return list(self)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3535, in __iter__
    return self._execute_and_instances(context)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1011, in execute
    return meth(self, multiparams, params)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1124, in _execute_clauseelement
    ret = self._execute_context(
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1316, in _execute_context
    self._handle_dbapi_exception(
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1510, in _handle_dbapi_exception
    util.raise_(
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1276, in _execute_context
    self.dialect.do_execute(
  File "/home/lucas/datapipeline/.env/lib/python3.8/site-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)
1 resposta
solução!

Rodei os codigos abaixo em um mesmo terminal e depois executei o python twitter_hook e pelo menos esse erro foi resolvido...agora tem outro =/

source .env/bin/activate
export AIRFLOW_HOME=$(pwd)/airflow
airflow initdb
python twitter_hook.py