def schema_create(dbname, name, owner=None, user=None, db_user=None, db_password=None, db_host=None, db_port=None):
 if schema_exists(dbname, name, db_user=db_user, db_password=db_password, db_host=db_host, db_port=db_port):
  log.info("'{0}' already exists in '{1}'".format(name, dbname))
  return False
 sub_cmd = 'CREATE SCHEMA "{0}"'.format(name)
 if (owner is not None):
  sub_cmd = '{0} AUTHORIZATION "{1}"'.format(sub_cmd, owner)
 ret = _psql_prepare_and_run(['-c', sub_cmd], user=db_user, password=db_password, port=db_port, host=db_host, maintenance_db=dbname, runas=user)
 return (ret['retcode'] == 0)

def schema_create ( dbname , name , owner = None , user = None , db_user = None , db_password = None , db_host = None , db_port = None ) : if schema_exists ( dbname , name , db_user = db_user , db_password = db_password , db_host = db_host , db_port = db_port ) : log . info ( "'{0}' already exists in '{1}'" . format ( name , dbname ) ) return False sub_cmd = 'CREATE SCHEMA "{0}"' . format ( name ) if ( owner is not None ) : sub_cmd = '{0} AUTHORIZATION "{1}"' . format ( sub_cmd , owner ) ret = _psql_prepare_and_run ( [ '-c' , sub_cmd ] , user = db_user , password = db_password , port = db_port , host = db_host , maintenance_db = dbname , runas = user ) return ( ret [ 'retcode' ] == 0 )
creates a postgres schema .