qcodes/dataset/sqlite/db_upgrades/__init__.py
def perform_db_upgrade_8_to_9(conn: ConnectionPlus) -> None:
    """
    Perform the upgrade from version 8 to version 9.

    Add indices on the runs table for captured_run_id
    """

    sql = "SELECT name FROM sqlite_master WHERE type='table' AND name='runs'"
    cur = atomic_transaction(conn, sql)
    n_run_tables = len(cur.fetchall())

    pbar = tqdm(range(1), file=sys.stdout)
    pbar.set_description("Upgrading database; v8 -> v9")

    if n_run_tables == 1:
        _IX_runs_captured_run_id = """
                                CREATE INDEX
                                IF NOT EXISTS IX_runs_captured_run_id
                                ON runs (captured_run_id DESC)
                                """
        with atomic(conn) as connection:
            # iterate through the pbar for the sake of the side effect; it
            # prints that the database is being upgraded
            for _ in pbar:
                transaction(connection, _IX_runs_captured_run_id)
    else:
        raise RuntimeError(f"found {n_run_tables} runs tables expected 1")

    Perform the upgrade from version 8 to version 9.

    Add indices on the runs table for captured_run_id
    
Perform the upgrade from version 8 to version 9.
Add indices on the runs table for captured_run_id
Perform the upgrade from version 8 to version 9 . Add indices on the runs table for captured_run_id
def perform_db_upgrade_8_to_9(conn: ConnectionPlus) -> None:
    sql = "SELECT name FROM sqlite_master WHERE type='table' AND name='runs'"
    cur = atomic_transaction(conn, sql)
    n_run_tables = len(cur.fetchall())
    pbar = tqdm(range(1), file=sys.stdout)
    pbar.set_description("Upgrading database; v8 -> v9")
    if n_run_tables == 1:
        _IX_runs_captured_run_id = """
                                CREATE INDEX
                                IF NOT EXISTS IX_runs_captured_run_id
                                ON runs (captured_run_id DESC)
                                """
        with atomic(conn) as connection:
            for _ in pbar:
                transaction(connection, _IX_runs_captured_run_id)
    else:
        raise RuntimeError(f"found {n_run_tables} runs tables expected 1")
def perform_db_upgrade_8_to_9 ( conn : ConnectionPlus ) -> None : sql = "SELECT name FROM sqlite_master WHERE type='table' AND name='runs'" cur = atomic_transaction ( conn , sql ) n_run_tables = len ( cur . fetchall ( ) ) pbar = tqdm ( range ( 1 ) , file = sys . stdout ) pbar . set_description ( "Upgrading database; v8 -> v9" ) if n_run_tables == 1 : _IX_runs_captured_run_id = """
                                CREATE INDEX
                                IF NOT EXISTS IX_runs_captured_run_id
                                ON runs (captured_run_id DESC)
                                """ with atomic ( conn ) as connection : for _ in pbar : transaction ( connection , _IX_runs_captured_run_id ) else : raise RuntimeError ( f"found {n_run_tables} runs tables expected 1" )
Perform the upgrade from version 8 to version 9.
Perform the upgrade from version 8 to version 9 .
"""
    Perform the upgrade from version 8 to version 9.

    Add indices on the runs table for captured_run_id
    """ # iterate through the pbar for the sake of the side effect; it # prints that the database is being upgraded
conn
ConnectionPlus