import csv


def load_csv_records(fileName):
    """Given a CSV filename, returns records (= list of tuples)
    Automatically transforms '2' to integer 2 and '1.9' to float 1.9
    Output format is list tuples to be consistent with the result of a database query"""
    def cast_if_possible(x):
        """Function that takes a string and returns int or float if possible, otherwise just string
        Useful when reading from database where output is string by default before casting"""
        try:
            return int(x)
        except ValueError:
            try:
                return float(x)
            except ValueError:
                return x
    records = []
    with open(fileName, 'rt') as f:
        reader = csv.reader(f, delimiter=',')
        for row in reader:
            row2 = [cast_if_possible(x) for x in row]
            records.append(tuple(row2))
    return records