eosphoros-ai / sqlgpt-parser

sqlgpt-parser is a Python implementation of an SQL parser that effectively converts SQL statements into Abstract Syntax Trees (AST). By leveraging AST tree comparisons between two SQL queries, it becomes possible to achieve robust evaluation of text-to-SQL models.
Apache License 2.0
24 stars 9 forks source link

Format function call and time interval error #6

Closed qidi1 closed 11 months ago

qidi1 commented 11 months ago

Format SQL

SELECT date FROM `inv` WHERE date=DATE_ADD(creation_time, INTERVAL 4 HOUR)

But error happened

 def visit_function_call(self, node, unmangle_names):
        ret = ""
>       arguments = self._join_expressions(node.args, unmangle_names)
E       AttributeError: 'FunctionCall' object has no attribute 'args'

It is caused by FunctionCall not having attribute args but having attribute arguments. And format code do not having visit_time_interval

qidi1 commented 11 months ago

https://github.com/eosphoros-ai/sqlgpt-parser/pull/7