Opened 9 years ago

Closed 3 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:


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/", line 142, in main_cli
  File "/srv/biblioteca/", line 160, in dbupdate
    run_dbupdate(app_config, global_config)
  File "/srv/biblioteca/", line 128, in run_dbupdate
    run_all_migrations(db, app_config, global_config)
  File "/srv/biblioteca/", line 155, in run_all_migrations
  File "/srv/biblioteca/", line 288, in init_or_migrate
  File "/srv/biblioteca/", line 944, in activity_migration
  File "/srv/biblioteca/", line 616, in create
  File "/srv/biblioteca/", line 1479, in _run_visitor
    conn._run_visitor(visitorcallable, element, **kwargs)
  File "/srv/biblioteca/", line 1122, in _run_visitor
  File "/srv/biblioteca/", line 122, in traverse_single
    return meth(obj, **kw)
  File "/srv/biblioteca/", line 89, in visit_table
  File "/srv/biblioteca/", line 662, in execute
  File "/srv/biblioteca/", line 720, in _execute_ddl
  File "/srv/biblioteca/", line 874, in _execute_context
  File "/srv/biblioteca/", line 1024, in _handle_dbapi_exception
  File "/srv/biblioteca/", line 196, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/srv/biblioteca/", line 867, in _execute_context
  File "/srv/biblioteca/", 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 anongoblin, 9 years ago

Summary: Sql alchemy doesn't broken databasesSql alchemy doesn't handle broken databases

comment:2 by Ben Sturmfels, 3 years ago

Resolution: no-action-required
Status: newclosed

Can't see a way forward on this - closing.

Note: See TracTickets for help on using tickets.