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

Before Change



    @staticmethod
    def parse_insert(sql):
        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])

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))

    def __init__(self, sql, integration=None, database=None):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: hyperspy/hyperspy
Commit Name: 904e72663b634ce65641c3c99e2219e91aefc671
Time: 2017-01-10
Author: eric.prestat@gmail.com
File Name: hyperspy/misc/date_time_tools.py
Class Name:
Method Name: update_date_time_in_metadata


Project Name: pantsbuild/pants
Commit Name: 24d8a1652b3bf99115c67ba9f47e06b172fe8e00
Time: 2015-10-09
Author: john.sirois@gmail.com
File Name: src/python/pants/engine/exp/mapper.py
Class Name: AddressMap
Method Name: parse