Opened 9 years ago
Closed 4 years ago
#5324 closed enhancement (no-action)
Sql alchemy doesn't handle broken databases
Reported by: | anongoblin | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | programming | Keywords: | |
Cc: | Parent Tickets: |
Description
My ./bin/gmg dbupdate
command went bad, and thus broke the instance.
When trying to execute a new dbupdate, I've come across this:
-> Updating main mediagoblin tables: + Running migration 24, "activity_migration"... Traceback (most recent call last): File "./bin/gmg", line 9, in <module> load_entry_point('mediagoblin==0.8.0', 'console_scripts', 'gmg')() File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/gmg_commands/__init__.py", line 142, in main_cli args.func(args) File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/gmg_commands/dbupdate.py", line 160, in dbupdate run_dbupdate(app_config, global_config) File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/gmg_commands/dbupdate.py", line 128, in run_dbupdate run_all_migrations(db, app_config, global_config) File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/gmg_commands/dbupdate.py", line 155, in run_all_migrations migration_manager.init_or_migrate() File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/db/migration_tools.py", line 288, in init_or_migrate migration_func(self.session) File "/srv/biblioteca/biblioteca.pirata.xyz/mediagoblin/db/migrations.py", line 944, in activity_migration ActivityIntermediator_R0.__table__.create(db.bind) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/schema.py", line 616, in create checkfirst=checkfirst) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1479, in _run_visitor conn._run_visitor(visitorcallable, element, **kwargs) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1122, in _run_visitor **kwargs).traverse_single(element) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/sql/visitors.py", line 122, in traverse_single return meth(obj, **kw) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/ddl.py", line 89, in visit_table self.connection.execute(schema.CreateTable(table)) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 662, in execute params) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 720, in _execute_ddl compiled File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 874, in _execute_context context) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 1024, in _handle_dbapi_exception exc_info File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/util/compat.py", line 196, in raise_from_cause reraise(type(exception), exception, tb=exc_tb) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/base.py", line 867, in _execute_context context) File "/srv/biblioteca/biblioteca.pirata.xyz/local/lib/python2.7/site-packages/SQLAlchemy-0.8.7-py2.7-linux-x86_64.egg/sqlalchemy/engine/default.py", line 324, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (ProgrammingError) relation "core__activity_intermediators" already exists '\nCREATE TABLE core__activity_intermediators (\n\tid SERIAL NOT NULL, \n\ttype VARCHAR NOT NULL, \n\tPRIMARY KEY (id)\n)\n\n' {}
I suppose the SQL statment from sqlalchemy should have a "IF_NOT_EXISTS" right after the "CREATE TABLE", but it doesn't.
My db remains broken, and thus the instance.
Change History (2)
comment:1 by , 9 years ago
Summary: | Sql alchemy doesn't broken databases → Sql alchemy doesn't handle broken databases |
---|
comment:2 by , 4 years ago
Resolution: | → no-action-required |
---|---|
Status: | new → closed |
Can't see a way forward on this - closing.