question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'trino' not in table.dialect_options

See original GitHub issue

A clear and concise description of what the bug is.

This seems related to #20043.

Our Superset/Trino integration has been broken by a recent update but I can’t yet figure out a fix.

Our dashboards and graphs that utilize Trino are failing with DB engine Error: 'TableClause' object has no attribute 'dialect_options'.

In the logs I’m also seeing 'trino' not in table.dialect_options and WARNING:superset.db_engine_specs:Unable to load SQLAlchemy dialect <class 'es.opendistro.sqlalchemy.ESHTTPSDialect'>: No module named 'sqlalchemy_trino'.

We’re on version 1.5.1 of Superset installed on a Python 3.9 Docker image via pip with extras, i.e. pip install apache-superset[db2,druid,elasticsearch,mysql,postgres,thumbnails,trino].

I see there has been a lot of activity lately around the Trino engine in this repo. I’m hoping someone with more intimate understanding of the SQLAlchemy dialect situation might be able to shed some light on what’s going on, and how to fix it.

How to reproduce the bug

  1. Create a Superset dashboard with a Trino data source
  2. Attempt to load the dashboard

Expected results

Dashboard loads and can access Trino.

Actual results

Errors mentioned above (stack trace at bottom).

Screenshots

Screen Shot 2022-09-21 at 12 10 38 PM

Environment

(please complete the following information):

  • browser type and version: Chrome
  • superset version: 1.5.1
  • python version: 3.9
  • node.js version: N/A
  • any feature flags active:

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

AttributeError: 'TableClause' object has no attribute 'dialect_options'
2022-09-21 15:28:03,660:ERROR:superset.views.base:'TableClause' object has no attribute 'dialect_options'
Traceback (most recent call last):
File "/opt/app-root/lib64/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
  rv = self.dispatch_request()
File "/opt/app-root/lib64/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
File "/opt/app-root/lib64/python3.9/site-packages/flask_appbuilder/security/decorators.py", line 104, in wraps
  return f(self, *args, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/superset/views/base_api.py", line 112, in wraps
  raise ex
File "/opt/app-root/lib64/python3.9/site-packages/superset/views/base_api.py", line 109, in wraps
  duration, response = time_function(f, self, *args, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/superset/utils/core.py", line 1468, in time_function
  response = func(*args, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/superset/utils/log.py", line 245, in wrapper
  value = f(*args, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/superset/charts/data/api.py", line 244, in data
  return self._get_data_response(
File "/opt/app-root/lib64/python3.9/site-packages/superset/charts/data/api.py", line 390, in _get_data_response
  result = command.run(force_cached=force_cached)
File "/opt/app-root/lib64/python3.9/site-packages/superset/charts/data/commands/get_data_command.py", line 43, in run
  payload = self._query_context.get_payload(
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context.py", line 96, in get_payload
  return self._processor.get_payload(cache_query_context, force_cached)
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context_processor.py", line 376, in get_payload
  query_results = [
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context_processor.py", line 377, in <listcomp>
  get_query_results(
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_actions.py", line 200, in get_query_results
  return result_func(query_context, query_obj, force_cached)
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_actions.py", line 104, in _get_full
  payload = query_context.get_df_payload(query_obj, force_cached=force_cached)
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context.py", line 115, in get_df_payload
  return self._processor.get_df_payload(query_obj, force_cached)
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context_processor.py", line 126, in get_df_payload
  query_result = self.get_query_result(query_obj)
File "/opt/app-root/lib64/python3.9/site-packages/superset/common/query_context_processor.py", line 186, in get_query_result
  result = query_context.datasource.query(query_object.to_dict())
File "/opt/app-root/lib64/python3.9/site-packages/superset/connectors/sqla/models.py", line 1693, in query
  query_str_ext = self.get_query_str_extended(query_obj)
File "/opt/app-root/lib64/python3.9/site-packages/superset/connectors/sqla/models.py", line 835, in get_query_str_extended
  sql = self.database.compile_sqla_query(sqlaq.sqla_query)
File "/opt/app-root/lib64/python3.9/site-packages/superset/models/core.py", line 466, in compile_sqla_query
  sql = str(qry.compile(engine, compile_kwargs={"literal_binds": True}))
File "<string>", line 1, in <lambda>
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/elements.py", line 481, in compile
  return self._compiler(dialect, bind=bind, **kw)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/elements.py", line 487, in _compiler
  return dialect.statement_compiler(dialect, self, **kw)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 592, in __init__
  Compiled.__init__(self, dialect, statement, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 322, in __init__
  self.string = self.process(self.statement, **compile_kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 352, in process
  return obj._compiler_dispatch(self, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 96, in _compiler_dispatch
  return meth(self, **kw)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 2201, in visit_select
  text = self._compose_select_body(
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 2292, in _compose_select_body
  [
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/compiler.py", line 2293, in <listcomp>
  f._compiler_dispatch(self, asfrom=True, **kwargs)
File "/opt/app-root/lib64/python3.9/site-packages/sqlalchemy/sql/visitors.py", line 96, in _compiler_dispatch
  return meth(self, **kw)
File "/opt/app-root/lib64/python3.9/site-packages/trino/sqlalchemy/compiler.py", line 121, in visit_table
  return self.add_catalog(sql, table)
File "/opt/app-root/lib64/python3.9/site-packages/trino/sqlalchemy/compiler.py", line 132, in add_catalog
  'trino' not in table.dialect_options
AttributeError: 'TableClause' object has no attribute 'dialect_options'

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
iercancommented, Sep 22, 2022

You can install trino==0.315.0. Seems like latest version is problematic.

2reactions
rylativitycommented, Sep 21, 2022

Exact same issue, error, and stacktrace as above, but using apache/superset:latest image from Docker Hub for testing and development. And also like Justin, I was using Superset with Trino for a while without issue, and this error only started appearing recently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SELECT — Trino 403 Documentation
When a table is sampled using the Bernoulli method, all physical blocks of the table are scanned and certain rows are skipped (based...
Read more >
Comparison functions and operators - Trino
The IS NULL and IS NOT NULL operators test whether a value is null (undefined). Both operators work for all data types. Using...
Read more >
Table functions — Trino 403 Documentation
A table function is a function returning a table. ... If the function is not registered by the specified catalog, the query fails....
Read more >
CREATE TABLE — Trino 403 Documentation
Create a new, empty table with the specified columns. Use CREATE TABLE AS to create a table with data. The optional IF NOT...
Read more >
CREATE TABLE AS — Trino 403 Documentation
The optional IF NOT EXISTS clause causes the error to be suppressed if the table already exists. The optional WITH clause can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found