Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Backticks in table name are being incorrectly escaped #92

Closed
enilsen16 opened this issue Aug 13, 2019 · 3 comments
Closed

Backticks in table name are being incorrectly escaped #92

enilsen16 opened this issue Aug 13, 2019 · 3 comments
Assignees

Comments

@enilsen16
Copy link

Possibly related to #35

SELECT * FROM `movies` when parsed and then formatted becomes SELECT * FROM "`movies`"

@enilsen16
Copy link
Author

It looks like some of the tests may depend on incorrect behavior.

    def verify_formatting(self, expected_sql, expected_json):
        new_sql = ""
        new_json = ""
        try:
            new_sql = format(expected_json)
            new_json = parse(new_sql)
            self.assertEqual(new_json, expected_json)
        except Exception as e:
            raise VerificationException(expected_sql, expected_json, new_sql, new_json)

Changing the original function (above) to:

    def verify_formatting(self, expected_sql, expected_json):
        new_sql = ""
        new_json = ""
        try:
            new_json = parse(expected_sql)
            new_sql = format(new_json)
            self.assertEqual(new_sql, expected_sql)
        except Exception as e:
            raise VerificationException(expected_sql, expected_json, new_sql, new_json)

really seems to break a lot of tests

@klahnakoski klahnakoski self-assigned this Jan 23, 2020
@klahnakoski
Copy link
Contributor

the verify_formatting() is only looking for stability: The SQL it generates can be parsed to the expected JSON. This was done to quickly make many tests; assuming the parser is correct.

In your case the parser is wrong. I will fix that.

@klahnakoski
Copy link
Contributor

fix is here

53b94ce

this will be merged shortly

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants