import re


def map_tablename_to_sql(sql):
    """
    Returns an array of dictionaries that map each tablename to its sql
    """
    regex = r'(CREATE TABLE\s+(\S+)\s+[^;]+;)'

    tables_with_sql = []
    for (sql, tablename) in re.findall(regex, sql, re.MULTILINE):
        tables_with_sql.append({
            'tablename': tablename,
            'sql': sql
            })

    return tables_with_sql