z6cr0b3rts opened a new issue, #20752:
URL: https://github.com/apache/superset/issues/20752

   After adding Trino as a source database, the user could experience error 
messages in the SQL Lab UI due to duplicated table/view names in the SQL Lab 
SQL Editor "See Table Schema" drop down.  I believe this is related to a 
similar issue that was [handled for 
Presto](https://github.com/apache/superset/blob/510c1c4817024af051cc30f315a042c282dbd3b2/superset/db_engine_specs/presto.py#L268)
 ... however may not have been addressed as part of [this 
refactoring](https://github.com/apache/superset/pull/20434).
   
   Ultimately, it looks like in the 
[db_engine_specs/trino.py](https://github.com/apache/superset/blob/master/superset/db_engine_specs/trino.py)
 the functions get_table_names() and get_view_names() both return the same 
identical list which generates duplicates in the UI.  This could be due to the 
fact that the following SQL Alchemy example returns the exact same list for 
both tables and views when working with Trino (tables will have same elements 
as views): 
   
   `  
   from sqlalchemy import create_engine
   from sqlalchemy import inspect
   
   # create engine from a URL and params
   # create inspector for engine
   
   tables = inspector.get_table_names(schema)
   views = inspector.get_view_names(schema)
   `
   
   #### How to reproduce the bug
   
   1. Go to Data -> Databases. 
   2. Click button to Add Database "+ Database"
   3. Choose Trino from supported databases and add a Trino datasource.
   4. After succesfully adding a Trino datasource, navigate to SQL Lab -> SQL 
Editor.
   5. In the database dropdown, choose the Trino datasource you added. 
   6. Refresh the schema drop down 
   7. Observe duplicates and potentially error messages in "See Table Schema" 
drop down.
   
   ### Expected results
   
   Would not expect to see duplicate entries for each table/view in the See 
Table Schema dropdown.
   
   ### Actual results
   
   Duplicate entires for each table/view in the See Table Schema dropdown.
   
   #### Screenshots
   
   Coming soon.
   
   ### Environment
   
   (please complete the following information):
   
   Coming soon.
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [ ] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [ ] I have reproduced the issue with at least the latest released version 
of superset.
   - [ ] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   I believe this has been handled for Presto but not Trino.  The [Trino engine 
spec](https://github.com/apache/superset/blob/92f3621c754a4f3ddb99285aad273296be26567e/superset/db_engine_specs/trino.py#L38)
 inherits from the [Presto engine 
spec](https://github.com/apache/superset/blob/master/superset/db_engine_specs/presto.py)
 however the Trino spec overrides the get_table_names and get_view_names 
functions by calling the default functions on the base engine object.  One 
option might be to leverage the functions in the Presto spec.  Another option 
might be to code the Trino functions similarly to what has been done for 
Presto.   
   


-- 
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