Skip to content
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

'Engine' object has no attribute 'connection' when calling get_table_comment #253

Closed
1 task done
ganczarek opened this issue Oct 7, 2022 · 1 comment · Fixed by #255
Closed
1 task done

'Engine' object has no attribute 'connection' when calling get_table_comment #253

ganczarek opened this issue Oct 7, 2022 · 1 comment · Fixed by #255
Assignees

Comments

@ganczarek
Copy link

ganczarek commented Oct 7, 2022

Expected behavior

Call to get_table_comment should not fail.

Actual behavior

When calling get_table_comment from Superset it fails with the following error:

2022-10-07 14:06:52,206:ERROR:root:'Engine' object has no attribute 'connection'
Traceback (most recent call last):
  File "/opt/superset/superset/db_engine_specs/base.py", line 1026, in get_table_comment
    comment = inspector.get_table_comment(table_name, schema)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/engine/reflection.py", line 558, in get_table_comment
    return self.dialect.get_table_comment(
  File "/usr/local/lib/python3.8/site-packages/trino/sqlalchemy/dialect.py", line 267, in get_table_comment
    catalog_name = self._get_default_catalog_name(connection)
  File "/usr/local/lib/python3.8/site-packages/trino/sqlalchemy/dialect.py", line 336, in _get_default_catalog_name
    dbapi_connection: trino_dbapi.Connection = connection.connection
AttributeError: 'Engine' object has no attribute 'connection'

A similar issue was fixed in PyAthena: laughingman7743/PyAthena#63. It makes me believe that the problem is not in Superset, but Trino client.

Steps To Reproduce

If you have a Superset setup with a Trino client, then:

  • go to SQL editor
  • select Trino database, any schema and any table
  • check Superset logs

Log output

No response

Operating System

Debian buster in Docker image python:3.8.13-slim-buster

Trino Python client version

0.316.0

Trino Server version

378.amzn.0

Python version

3.8.13

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@mdesmet
Copy link
Contributor

mdesmet commented Oct 12, 2022

Tested with Superset (master), dev version of trino-python-client and sqlalchemy 1.4

image

No errors in superset log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants