def database_exists(name, **kwargs):
 with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
  res = query(("SHOW DATABASES LIKE '%(name)s';" % {'name': name}), **kwargs)
 return (res.succeeded and (res == name))

def database_exists ( name , ** kwargs ) : with settings ( hide ( 'running' , 'stdout' , 'stderr' , 'warnings' ) , warn_only = True ) : res = query ( ( "SHOW DATABASES LIKE '%(name)s';" % { 'name' : name } ) , ** kwargs ) return ( res . succeeded and ( res == name ) )
check if a mysql database exists .