@with_session
def reset_schema(plugin, session=None):
 if (plugin not in plugin_schemas):
  raise ValueError((u'The plugin %s has no stored schema to reset.' % plugin))
 table_names = plugin_schemas[plugin].get(u'tables', [])
 tables = [table_schema(name, session) for name in table_names]
 for table in tables:
  try:
   table.drop()
  except OperationalError as e:
   if (u'no such table' in str(e)):
    continue
   raise e
 session.query(PluginSchema).filter((PluginSchema.plugin == plugin)).delete()
 session.commit()
 Base.metadata.create_all(bind=session.bind)

@ with_session def reset_schema ( plugin , session = None ) : if ( plugin not in plugin_schemas ) : raise ValueError ( ( u'The plugin %s has no stored schema to reset.' % plugin ) ) table_names = plugin_schemas [ plugin ] . get ( u'tables' , [ ] ) tables = [ table_schema ( name , session ) for name in table_names ] for table in tables : try : table . drop ( ) except OperationalError as e : if ( u'no such table' in str ( e ) ) : continue raise e session . query ( PluginSchema ) . filter ( ( PluginSchema . plugin == plugin ) ) . delete ( ) session . commit ( ) Base . metadata . create_all ( bind = session . bind )
removes all tables from given plugin from the database .