-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing tables returned by sql_metadata.get_query_tables #112
Comments
@tdebroc , thanks for reporting a bug! Can you please provide the full list of queries for the sake of better test coverage with more queries? GitHub's gist link will do 🙂 Thanks! |
Hello macbre, yes I'll try to add some, it just very long queries and I need to anonymize them, so it takes time, but yes I'll do it because your project is nice :-) |
Here is another one:
which does't work There is a problem with "(", because if I remove it, it works. For info, I ended up writing my own parsing script and I remove all "(" ")" to do the check |
I checked on the 27 diffs I have and
Example:
should only return |
Wow you are fast ! I saw the tests case you have added, for the WITH, one interesting to add would be if there is several tables generated in the WITH: Example: WITH
database1.tableFromWith AS SELECT * FROM table3,
database1.tableFromWith2 AS SELECT * FROM table4,
database1.tableFromWith3 AS SELECT * FROM table5,
database1.tableFromWith4 AS SELECT * FROM table6
SELECT
"xxxxx"
FROM
database1.tableFromWith alias
LEFT JOIN database2.table2 ON ("tt"."ttt"."fff" = "xx"."xxx") which should only return database2.table2 Best regards |
🙂 As said above, I'll add the test that you suggested 👌🏻. In the meantime, stay tuned 🙂 |
And a test case from the MySQL docs: WITH
cte1 AS (SELECT a, b FROM table1),
cte2 AS (SELECT c, d FROM table2)
SELECT b, d FROM cte1 JOIN cte2
WHERE cte1.a = cte2.c; |
Hello,
I have 80 long queries, and for 27 of them, results are not correct for "sql_metadata.get_query_tables(ddl)"
Here is an example:
ddl_for_sql_metadata.sql
Quick way to test:
It returns only ['database2.table2', 'database3.table3']
and it should return database1.table1
The text was updated successfully, but these errors were encountered: