villebro commented on code in PR #21535:
URL: https://github.com/apache/superset/pull/21535#discussion_r1188541523


##########
tests/unit_tests/sql_parse_tests.py:
##########
@@ -525,6 +558,16 @@ def test_extract_tables_reusing_aliases() -> None:
 with q1 as ( select key from q2 where key = '5'),
 q2 as ( select key from src where key = '5')
 select * from (select key from q1) a
+"""
+        )
+        == {Table("q2"), Table("src")}
+    )

Review Comment:
   are we really sure that the `q2` reference in the `q1` CTE will in fact 
reference the table `q2` in the database? I did the following test on my devenv 
which has examples data and the superset metadata in the same database, and 
   
   ```sql
   with q1 as ( select distinct gender from birth_names),
   birth_names as ( select * from ab_role)
   select * from (select gender from q1) a
   ```
   
   produces the following error:
   
   > sqlite error: no such column: gender
   
   This would indicate to me that it was looking for `gender` in `ab_role`, not 
the actual `birth_names` table. So to me it appears as if only `src` is in fact 
only referenced here, right?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to