{"action":"created","issue":{"url":"https://api.github.com/repos/pudo/dataset/issues/131","labels_url":"https://api.github.com/repos/pudo/dataset/issues/131/labels{/name}","comments_url":"https://api.github.com/repos/pudo/dataset/issues/131/comments","events_url":"https://api.github.com/repos/pudo/dataset/issues/131/events","html_url":"https://github.com/pudo/dataset/issues/131","id":91095295,"number":131,"title":"drop_column() fails with OperationalError ","user":{"login":"mgaitan","id":2355719,"avatar_url":"https://avatars.githubusercontent.com/u/2355719?v=3","gravatar_id":"","url":"https://api.github.com/users/mgaitan","html_url":"https://github.com/mgaitan","followers_url":"https://api.github.com/users/mgaitan/followers","following_url":"https://api.github.com/users/mgaitan/following{/other_user}","gists_url":"https://api.github.com/users/mgaitan/gists{/gist_id}","starred_url":"https://api.github.com/users/mgaitan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgaitan/subscriptions","organizations_url":"https://api.github.com/users/mgaitan/orgs","repos_url":"https://api.github.com/users/mgaitan/repos","events_url":"https://api.github.com/users/mgaitan/events{/privacy}","received_events_url":"https://api.github.com/users/mgaitan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-06-25T22:40:42Z","updated_at":"2015-06-29T09:20:42Z","closed_at":null,"body":"```python\r\nIn [37]: publications.columns\r\nOut[37]: ['id', 'title', 'journal', 'year', 'authors', 'doi', 'cited_by', 'not_found']\r\n\r\nIn [38]: publications.drop_column(\"not_found\")\r\n---------------------------------------------------------------------------\r\nOperationalError                          Traceback (most recent call last)\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)\r\n   1138                         parameters,\r\n-> 1139                         context)\r\n   1140         except Exception as e:\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/default.py in do_execute(self, cursor, statement, parameters, context)\r\n    449     def do_execute(self, cursor, statement, parameters, context=None):\r\n--> 450         cursor.execute(statement, parameters)\r\n    451 \r\n\r\nOperationalError: near \"DROP\": syntax error\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nOperationalError                          Traceback (most recent call last)\r\n<ipython-input-38-3f86de9110c9> in <module>()\r\n----> 1 publications.drop_column(\"not_found\")\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/dataset/persistence/table.py in drop_column(self, name)\r\n    258                 self.database.op.drop_column(\r\n    259                     self.table.name,\r\n--> 260                     name\r\n    261                 )\r\n    262                 self.table = self.database.update_table(self.table.name)\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/alembic/operations.py in drop_column(self, table_name, column_name, **kw)\r\n    648             table_name,\r\n    649             self._column(column_name, NULLTYPE),\r\n--> 650             **kw\r\n    651         )\r\n    652 \r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/alembic/ddl/impl.py in drop_column(self, table_name, column, schema, **kw)\r\n    177 \r\n    178     def drop_column(self, table_name, column, schema=None, **kw):\r\n--> 179         self._exec(base.DropColumn(table_name, column, schema=schema))\r\n    180 \r\n    181     def add_constraint(self, const):\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/alembic/ddl/impl.py in _exec(self, construct, execution_options, multiparams, params)\r\n    120             if execution_options:\r\n    121                 conn = conn.execution_options(**execution_options)\r\n--> 122             return conn.execute(construct, *multiparams, **params)\r\n    123 \r\n    124     def execute(self, sql, execution_options=None):\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in execute(self, statement, *multiparams, **params)\r\n   1987 \r\n   1988         connection = self.contextual_connect(close_with_result=True)\r\n-> 1989         return connection.execute(statement, *multiparams, **params)\r\n   1990 \r\n   1991     def scalar(self, statement, *multiparams, **params):\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in execute(self, object, *multiparams, **params)\r\n    912                 type(object))\r\n    913         else:\r\n--> 914             return meth(self, multiparams, params)\r\n    915 \r\n    916     def _execute_function(self, func, multiparams, params):\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/sql/ddl.py in _execute_on_connection(self, connection, multiparams, params)\r\n     66 \r\n     67     def _execute_on_connection(self, connection, multiparams, params):\r\n---> 68         return connection._execute_ddl(self, multiparams, params)\r\n     69 \r\n     70     def execute(self, bind=None, target=None):\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _execute_ddl(self, ddl, multiparams, params)\r\n    966             compiled,\r\n    967             None,\r\n--> 968             compiled\r\n    969         )\r\n    970         if self._has_events or self.engine._has_events:\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)\r\n   1144                 parameters,\r\n   1145                 cursor,\r\n-> 1146                 context)\r\n   1147 \r\n   1148         if self._has_events or self.engine._has_events:\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _handle_dbapi_exception(self, e, statement, parameters, cursor, context)\r\n   1339                 util.raise_from_cause(\r\n   1340                     sqlalchemy_exception,\r\n-> 1341                     exc_info\r\n   1342                 )\r\n   1343             else:\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/util/compat.py in raise_from_cause(exception, exc_info)\r\n    186             exc_info = sys.exc_info()\r\n    187         exc_type, exc_value, exc_tb = exc_info\r\n--> 188         reraise(type(exception), exception, tb=exc_tb, cause=exc_value)\r\n    189 else:\r\n    190     exec(\"def reraise(tp, value, tb=None, cause=None):\\n\"\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/util/compat.py in reraise(tp, value, tb, cause)\r\n    179             value.__cause__ = cause\r\n    180         if value.__traceback__ is not tb:\r\n--> 181             raise value.with_traceback(tb)\r\n    182         raise value\r\n    183 \r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/base.py in _execute_context(self, dialect, constructor, statement, parameters, *args)\r\n   1137                         statement,\r\n   1138                         parameters,\r\n-> 1139                         context)\r\n   1140         except Exception as e:\r\n   1141             self._handle_dbapi_exception(\r\n\r\n/home/tin/.virtualenvs/curso/lib/python3.4/site-packages/sqlalchemy/engine/default.py in do_execute(self, cursor, statement, parameters, context)\r\n    448 \r\n    449     def do_execute(self, cursor, statement, parameters, context=None):\r\n--> 450         cursor.execute(statement, parameters)\r\n    451 \r\n    452     def do_execute_no_params(self, cursor, statement, context=None):\r\n\r\nOperationalError: (sqlite3.OperationalError) near \"DROP\": syntax error [SQL: 'ALTER TABLE publication DROP COLUMN not_found']\r\n\r\nIn [39]: !pip freeze | grep dataset\r\ndataset==0.6.0\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/pudo/dataset/issues/comments/116560582","html_url":"https://github.com/pudo/dataset/issues/131#issuecomment-116560582","issue_url":"https://api.github.com/repos/pudo/dataset/issues/131","id":116560582,"user":{"login":"pudo","id":41628,"avatar_url":"https://avatars.githubusercontent.com/u/41628?v=3","gravatar_id":"","url":"https://api.github.com/users/pudo","html_url":"https://github.com/pudo","followers_url":"https://api.github.com/users/pudo/followers","following_url":"https://api.github.com/users/pudo/following{/other_user}","gists_url":"https://api.github.com/users/pudo/gists{/gist_id}","starred_url":"https://api.github.com/users/pudo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pudo/subscriptions","organizations_url":"https://api.github.com/users/pudo/orgs","repos_url":"https://api.github.com/users/pudo/repos","events_url":"https://api.github.com/users/pudo/events{/privacy}","received_events_url":"https://api.github.com/users/pudo/received_events","type":"User","site_admin":false},"created_at":"2015-06-29T09:20:42Z","updated_at":"2015-06-29T09:20:42Z","body":"Thanks for the report and the test. I wonder what our options are, I see two: wrap this failure in a nicer error to make it clear it's a backend issue, or implement the whole ``DROP TABLE`` dance. My preference would be the former, since dropping columns is a pretty fringe thing to begin with. What do people think? "}}