Merge the partial database into the master database.
    :param master: database connection to the master database
    :param part: database connection to the partial database

def merge_databases(master, part):
    """
    Merge the partial database into the master database.
    :param master: database connection to the master database
    :param part: database connection to the partial database
    """
    mcur = master.cursor()
    pcur = part.cursor()

    logger.debug("Merging databases...")
    tables = get_table_list(part)
    for table in tables:
        cols = get_table_columns(part, table)
        pcur.execute("SELECT * FROM '%s'" % table)
        rows = pcur.fetchall()
        if rows:
            try:
                logger.debug("Found   {n} rows of table '{name}' in master".format(name=table, n=rows[0][1]-1))
            except Exception as e:
                logging.error(e)
            if not check_table_exists(master, table):
                create_table(master, table, cols)

            args = ("?," * len(cols))[:-1]
            query = "INSERT INTO '{name}' VALUES ({args})".format(name=table, args=args)
            mcur.executemany(query, tuple(tuple(r) for r in rows))
            logger.debug("Merging {m} rows of table '{name}' into master".format(name=table, m=len(rows)))

    master.commit()