3c8bfbcdc608b0a868e655d647da3c8a33aa7449,mindsdb/api/mysql/mysql_proxy/classes/sql_query.py,SQLQuery,parse_insert,#Any#,52

Before Change


        search = re.search(r"(\(.*\)).*(\(.*\))", sql)
        columns = search.groups()[0].split(",")
        columns = [x.strip("(` )") for x in columns]
        p = re.compile("\s*,\s*".join(["(".*")"] * len(columns)))
        values = re.search(p, search.groups()[1])
        values = [x.strip("( ")") for x in values.groups()]

        return dict(zip(columns, values))

    def __init__(self, sql, integration=None, database=None):

After Change


        p = parse(f"select ({columns})")["select"]["value"]
        columns = p["literal"] if isinstance(p, dict) else p

        p = parse(f"select ({values})")["select"]["value"]
        values = p["literal"] if isinstance(p, dict) else p

        return dict(zip(columns, values))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: mindsdb/mindsdb
Commit Name: 3c8bfbcdc608b0a868e655d647da3c8a33aa7449
Time: 2020-07-23
Author: stpmax@yandex.ru
File Name: mindsdb/api/mysql/mysql_proxy/classes/sql_query.py
Class Name: SQLQuery
Method Name: parse_insert


Project Name: pantsbuild/pants
Commit Name: 9228ad83a3ecde2fb5a714d1eb43c7c1ee2e200b
Time: 2020-04-15
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/rules/core/fmt_test.py
Class Name: FmtTest
Method Name: test_multiple_languages_with_multiple_targets


Project Name: pantsbuild/pants
Commit Name: 9228ad83a3ecde2fb5a714d1eb43c7c1ee2e200b
Time: 2020-04-15
Author: 14852634+Eric-Arellano@users.noreply.github.com
File Name: src/python/pants/rules/core/fmt_test.py
Class Name: FmtTest
Method Name: test_single_language_with_multiple_targets