Closed engigu closed 10 months ago
@EngiGu Good day! Thank you for reporting this. I can not reproduce this problem, maybe you are using an old version? The current version is https://pypi.org/project/mo-sql-parsing/9.460.23319/
def test_issue_209_lambda(self):
sql = "select * from ta where id = 'xxxx'"
expected = "SELECT * FROM ta WHERE id = 'xxxx'"
result = format(parse(sql))
self.assertEqual(result, expected)
nm, I see those parameters are important. working...
I have long forgotten about the should_quote
parameter; it is expecting a function that will return truthy if the identifier should be quoted. In your case the lambda is returning "`", which is truthy, so it will quote everything, including "*".
I suggest letting the formatter decide the quotes, or you make one that excludes "*" and reserved words: https://github.com/klahnakoski/mo-sql-parsing/blob/dacb3c81dca1a4defae54ee0660c0dde610d282b/mo_sql_parsing/formatting.py#L43
Thank you, I know how to do it now, close.
`*` is not what I want.