Insert python list of tuples into SQL table

    Args:
        data (list): List of tuples
        table (str): Name of database table
        conn (connection object): database connection object
        columns (str): String of column names to use if not assigned then all columns are presumed to be used [Optional]
        db_type (str): If "sqlite" or "mysql"

def insert_query_m(data, table, conn, columns=None, db_type='mysql'):
    """ Insert python list of tuples into SQL table

    Args:
        data (list): List of tuples
        table (str): Name of database table
        conn (connection object): database connection object
        columns (str): String of column names to use if not assigned then all columns are presumed to be used [Optional]
        db_type (str): If "sqlite" or "mysql"

    """
    # if length of data is very large we need to break into chunks the insert_query_m is then used recursively untill
    # all data has been inserted
    if len(data) > 10000:
        _chunk_query(data, 10000, columns, conn, table, db_type)
    else:
        # sqlite and mysql have type string (? or %s) reference to use
        if db_type == 'sqlite':
            type_sign = '?'
        else:
            type_sign = '%s'
        # create a string of types for the insertion string (e.g. ?,?,? if inserting 3 columns of data)
        type_com = type_sign + ", "
        type = type_com * (len(data[0]) - 1)
        type = type + type_sign

        # if using specific columns to insert data
        if columns:
            stmt = "INSERT INTO " + table + "( " + columns + ") VALUES (" + type + ")"
        else:
            stmt = "INSERT INTO " + table + " VALUES (" + type + ")"

        # execute query
        cursor = conn.cursor()
        cursor.executemany(stmt, data)
        conn.commit()