micahflee / semiphemeral

Automatically delete your old tweets, except for the ones you want to keep
MIT License
884 stars 85 forks source link

sqlite3.OperationalError: no such column: tweets.user_id #3

Closed KonradIT closed 5 years ago

KonradIT commented 5 years ago

When running app.py fetch I get the following error:

konrad@konrad-pc [semiphemeral (master)]: pipenv run python ./app.py fetch
semiphemeral 0.1
Fetching all tweets, this first run may take a long time
Traceback (most recent call last):
  File "/home/konrad/.local/share/virtualenvs/semiphemeral-iqxB5Xmf/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/home/konrad/.local/share/virtualenvs/semiphemeral-iqxB5Xmf/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 550, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: tweets.user_id

The above exception was the direct cause of the following exception:

Happens on both pipenv run python ./app.py fetch and semiphemeral fetch

KonradIT commented 5 years ago

Happens on /settings save as well:

Calculating which threads should be excluded
[2019-06-05 20:15:06,553] ERROR in app: Exception on /settings [POST]
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 550, in do_execute
    cursor.execute(statement, parameters)
sqlite3.OperationalError: no such column: tweets_1.user_id

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 2311, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1834, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1737, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.7/site-packages/flask/_compat.py", line 36, in reraise
    raise value
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1832, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.7/site-packages/flask/app.py", line 1818, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/lib/python3.7/site-packages/semiphemeral/web.py", line 58, in edit_settings
    twitter.calculate_excluded_threads()
  File "/usr/lib/python3.7/site-packages/semiphemeral/twitter.py", line 212, in calculate_excluded_threads
    .filter(Tweet.favorite_count >= self.common.settings.get('tweets_like_threshold')) \
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3167, in all
    return list(self)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3323, in __iter__
    return self._execute_and_instances(context)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3348, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 988, in execute
    return meth(self, multiparams, params)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 287, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1107, in _execute_clauseelement
    distilled_params,
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1248, in _execute_context
    e, statement, parameters, cursor, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1466, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 383, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 128, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1244, in _execute_context
    cursor, statement, parameters, context
  File "/usr/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 550, in do_execute
    cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such column: tweets_1.user_id
[SQL: SELECT threads.id AS threads_id, threads.root_status_id AS threads_root_status_id, threads.should_exclude AS threads_should_exclude 
FROM threads JOIN tweets AS tweets_1 ON threads.id = tweets_1.thread_id 
WHERE tweets_1.user_id = ? AND tweets_1.is_deleted = ? AND tweets_1.is_retweet = ? AND tweets_1.retweet_count >= ? AND tweets_1.favorite_count >= ?]
[parameters: (2199716367, 0, 0, 5, 10)]
(Background on this error at: http://sqlalche.me/e/e3q8)
127.0.0.1 - - [05/Jun/2019 20:15:06] "POST /settings HTTP/1.1" 500 -
micahflee commented 5 years ago

Strange I'm not reproducing. It looks like you're running this from the source tree instead of installing from pip. Are you using pipenv and having the dependencies installed, e.g. pipenv run python ./app.py fetch instead of just ./app.py fetch?

KonradIT commented 5 years ago

It was my browser configuration. Using Chrome fixed the issue.