Пример #1
0
def load_schema(schema=None, session=None):
    """
    Wizard to unset secondary_engine for tables in schema

    Args:
        schema (string): The session to be used on the operation.
        session (object): The optional session object

    """

    # Get hold of the global shell object
    import mysqlsh
    shell = mysqlsh.globals.shell

    if session is None:
        session = shell.get_session()
        if session is None:
            print("No session specified. Either pass a session object to this "
                  "function or connect the shell to a database")
            return

    if schema is None:
        print("No schema specified.")
        return

    if __isHeatWavePlugin(session):
        result = __loadSecTables(session, schema)
        shell.dump_rows(result)

    return
Пример #2
0
def list_sec_loaded_tables(schema=None, session=None):
    """
    Wizard to list secondary engine with data loaded tables 

    Args:
        schema (string): The session to be used on the operation.
        session (object): The optional session object

    """
    # Get hold of the global shell object
    import mysqlsh
    shell = mysqlsh.globals.shell

    if session is None:
        session = shell.get_session()
        if session is None:
            print("No session specified. Either pass a session object to this "
                  "function or connect the shell to a database")
            return

    if __isHeatWavePlugin(session) is False:
        print("No HeatWave Plugin")
        return

    if __isHeatWaveOnline(session):
        # db = session.get_schema(schema)
        tables = __returnSecLoadedTables(session, schema)
        return tables

    return
Пример #3
0
def unload_schema(schema=None, session=None):
    """
    Wizard to unload secondary_engine for tables in schema

    Args:
        schema (string): The session to be used on the operation.
        session (object): The optional session object

    """

    # Get hold of the global shell object
    import mysqlsh
    shell = mysqlsh.globals.shell

    if session is None:
        session = shell.get_session()
        if session is None:
            print("No session specified. Either pass a session object to this "
                  "function or connect the shell to a database")
            return

    if schema is None:
        print("No schema specified.")
        return

    if __isHeatWavePlugin(session) is False:
        print("No HeatWave Plugin")
        return
    if __isHeatWaveOnline(session):
        table = __returnSecLoadedTables(session, schema)
        for i in table:
            print('alter table ' + i + ' secondary_unload')
            result = session.run_sql('alter table ' + i + ' secondary_unload')
            shell.dump_rows(result)

    return