def alter_db(name, character_set=None, collate=None, **connection_args):
 dbc = _connect(**connection_args)
 if (dbc is None):
  return []
 cur = dbc.cursor()
 existing = db_get(name, **connection_args)
 qry = 'ALTER DATABASE {0} CHARACTER SET {1} COLLATE {2};'.format(name.replace('%', '\\%').replace('_', '\\_'), (character_set or existing.get('character_set')), (collate or existing.get('collate')))
 args = {}
 _execute(cur, qry, args)

def alter_db ( name , character_set = None , collate = None , ** connection_args ) : dbc = _connect ( ** connection_args ) if ( dbc is None ) : return [ ] cur = dbc . cursor ( ) existing = db_get ( name , ** connection_args ) qry = 'ALTER DATABASE {0} CHARACTER SET {1} COLLATE {2};' . format ( name . replace ( '%' , '\\%' ) . replace ( '_' , '\\_' ) , ( character_set or existing . get ( 'character_set' ) ) , ( collate or existing . get ( 'collate' ) ) ) args = { } _execute ( cur , qry , args )
modify database using alter database %s character set %s collate %s; query .