ealtuna opened a new issue #10136:
URL: https://github.com/apache/incubator-superset/issues/10136


   The current support it does not work in the "SQL Lab". When you try to 
explore the database you get the list of schemas, but once you try drill down 
to get the list of tables for an schema, it fails. When you go to the logs in 
the server the error says it's unable to parse the response.
   
   ```
   (pyodbc.Error) ('HY000', '[HY000] [Dremio][Connector] (1040) Dremio failed 
to execute the query: SELECT TABLE_NAME FROM INFORMATION_SCHEMA."TABLES" WHERE 
TABLE_SCHEMA = :schema\n[30038]Query execution error. Details:[ \nPARSE ERROR: 
Failure parsing the query.\n\nSQL Query SELECT TABLE_NAME FROM 
INFORMATION_SCHEMA."TABLES" WHERE TABLE_SCHEMA = :schema\nstartLine 
1\nstartColumn 71\nendLine 1\nendColumn 71\nSQL Query SELECT TABLE_NAME FROM 
INFORMATION_SCHEMA."TABLES" WHERE TAB...[see log] (1040) (SQLPrepare)')
   [SQL: SELECT TABLE_NAME FROM INFORMATION_SCHEMA."TABLES" WHERE TABLE_SCHEMA 
= :schema]
   ```
   
   I was able to replicate the same error using the installation instructions 
for Docker and native in MacOS.
   
   In my opinion the key to the solution is in:
   
   https://github.com/apache/incubator-superset/pull/7048/files
   
   I was able to make it work replacing the file 
`/app/superset/db_engine_specs/dremio.py` with:
   
   ```
   class DremioBaseEngineSpec(BaseEngineSpec):
   
       engine = "dremio"
   
       _time_grain_expressions = {
           None: "{col}",
           "PT1S": "DATE_TRUNC('second', {col})",
           "PT1M": "DATE_TRUNC('minute', {col})",
           "PT1H": "DATE_TRUNC('hour', {col})",
           "P1D": "DATE_TRUNC('day', {col})",
           "P1W": "DATE_TRUNC('week', {col})",
           "P1M": "DATE_TRUNC('month', {col})",
           "P0.25Y": "DATE_TRUNC('quarter', {col})",
           "P1Y": "DATE_TRUNC('year', {col})",
       }
   
       @classmethod
       def get_table_names(cls, database: "Database", inspector, schema):
           sql = f'SELECT TABLE_NAME FROM INFORMATION_SCHEMA."TABLES" WHERE 
TABLE_SCHEMA = \'{schema}\''
           schemas = [row[0] for row in inspector.engine.execute(sql)
                      if not row[0].startswith('_')]
           return sorted(schemas)
   
       @classmethod
       def epoch_to_dttm(cls) -> str:
           return "TO_DATE({col})"
   
   ```
   
   not sure if with the current version other changes in the previous PR are 
still relevant. Also I noticed in the base class `BaseEngineSpec` the schema is 
of type Optional[str], I think this is never going to be the case for Dremio, 
but it needs validation. 


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

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