oas_dev/util/var_overview_sql.py
def create_database_and_add_model(models,database):
    """
    Add a table for variables in each model
    :param models:
    :param database:
    :return:
    """
    conn =sqlite3.connect(database)
    for model in models:
        mod_tab_name = model.replace('-','_')
        sql_create_projects_table = """ CREATE TABLE IF NOT EXISTS %s (
                                        case_var text NOT NULL PRIMARY KEY,
                                        model_case text NOT NULL,
                                        var text NOT NULL,
                                        case_name text NOT NULL,
                                        original_var_name text,
                                        units text ,
                                        units_original text,
                                        lev_is_dim integer NOT NULL,
                                        is_computed_var integer,
                                        path_computed_data text,
                                        pressure_coordinate_path text
                                    ); """%(mod_tab_name)

        # create a database connection
        if conn is not None:
            # create projects table
            create_table(conn, sql_create_projects_table)
        else:
            print("Error! cannot create the database connection.")
    conn.close()
    return

    Add a table for variables in each model
    :param models:
    :param database:
    :return:
    
Add a table for variables in each model
Add a table for variables in each model
def create_database_and_add_model(models,database):
    conn =sqlite3.connect(database)
    for model in models:
        mod_tab_name = model.replace('-','_')
        sql_create_projects_table = """ CREATE TABLE IF NOT EXISTS %s (
                                        case_var text NOT NULL PRIMARY KEY,
                                        model_case text NOT NULL,
                                        var text NOT NULL,
                                        case_name text NOT NULL,
                                        original_var_name text,
                                        units text ,
                                        units_original text,
                                        lev_is_dim integer NOT NULL,
                                        is_computed_var integer,
                                        path_computed_data text,
                                        pressure_coordinate_path text
                                    ); """%(mod_tab_name)
        if conn is not None:
            create_table(conn, sql_create_projects_table)
        else:
            print("Error! cannot create the database connection.")
    conn.close()
    return
def create_database_and_add_model ( models , database ) : conn = sqlite3 . connect ( database ) for model in models : mod_tab_name = model . replace ( '-' , '_' ) sql_create_projects_table = """ CREATE TABLE IF NOT EXISTS %s (
                                        case_var text NOT NULL PRIMARY KEY,
                                        model_case text NOT NULL,
                                        var text NOT NULL,
                                        case_name text NOT NULL,
                                        original_var_name text,
                                        units text ,
                                        units_original text,
                                        lev_is_dim integer NOT NULL,
                                        is_computed_var integer,
                                        path_computed_data text,
                                        pressure_coordinate_path text
                                    ); """ % ( mod_tab_name ) if conn is not None : create_table ( conn , sql_create_projects_table ) else : print ( "Error! cannot create the database connection." ) conn . close ( ) return
Add a table for variables in each model
Add a table for variables in each model
"""
    Add a table for variables in each model
    :param models:
    :param database:
    :return:
    """ # create a database connection # create projects table
None
models
None
database
None