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

Error in SQL Lab or trying to create a Dataset based on Hive #28560

Open
3 tasks done
alessio-bernesco opened this issue May 17, 2024 · 1 comment
Open
3 tasks done

Error in SQL Lab or trying to create a Dataset based on Hive #28560

alessio-bernesco opened this issue May 17, 2024 · 1 comment
Labels
data:connect:hive Related to Hive sqllab Namespace | Anything related to the SQL Lab

Comments

@alessio-bernesco
Copy link

Bug description

After connecting to a Hive server (created throug a Flink Sql Gateway) i can browse the schema and tables list but when showing the table schema there's an exception in the logs:

superset_app          | 2024-05-15 09:53:27,461:ERROR:flask_appbuilder.api:'bool' object has no attribute 'strip'
superset_app          | Traceback (most recent call last):
superset_app          |   File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/__init__.py", line 110, in wraps
superset_app          |     return f(self, *args, **kwargs)
superset_app          |   File "/app/superset/views/base_api.py", line 127, in wraps
superset_app          |     raise ex
superset_app          |   File "/app/superset/views/base_api.py", line 121, in wraps
superset_app          |     duration, response = time_function(f, self, *args, **kwargs)
superset_app          |   File "/app/superset/utils/core.py", line 1463, in time_function
superset_app          |     response = func(*args, **kwargs)
superset_app          |   File "/app/superset/utils/log.py", line 255, in wrapper
superset_app          |     value = f(*args, **kwargs)
superset_app          |   File "/app/superset/databases/api.py", line 741, in table_metadata
superset_app          |     table_info = get_table_metadata(database, table_name, schema_name)
superset_app          |   File "/app/superset/databases/utils.py", line 67, in get_table_metadata
superset_app          |     columns = database.get_columns(table_name, schema_name)
superset_app          |   File "/app/superset/models/core.py", line 847, in get_columns
superset_app          |     return self.db_engine_spec.get_columns(
superset_app          |   File "/app/superset/db_engine_specs/hive.py", line 419, in get_columns
superset_app          |     return BaseEngineSpec.get_columns(inspector, table_name, schema, options)
superset_app          |   File "/app/superset/db_engine_specs/base.py", line 1343, in get_columns
superset_app          |     cast(list[SQLAColumnType], inspector.get_columns(table_name, schema))
superset_app          |   File "/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/reflection.py", line 497, in get_columns
superset_app          |     col_defs = self.dialect.get_columns(
superset_app          |   File "/usr/local/lib/python3.10/site-packages/pyhive/sqlalchemy_hive.py", line 325, in get_columns
superset_app          |     rows = [[col.strip() if col else None for col in row] for row in rows]
superset_app          |   File "/usr/local/lib/python3.10/site-packages/pyhive/sqlalchemy_hive.py", line 325, in <listcomp>
superset_app          |     rows = [[col.strip() if col else None for col in row] for row in rows]
superset_app          |   File "/usr/local/lib/python3.10/site-packages/pyhive/sqlalchemy_hive.py", line 325, in <listcomp>
superset_app          |     rows = [[col.strip() if col else None for col in row] for row in rows]
superset_app          | AttributeError: 'bool' object has no attribute 'strip'

How to reproduce the bug

In the SQL Lab or "Create Dataset" area try to connect to a Hive server created by Flink Sql Gateway, the connection and table list is retrieved but whe browsing for the table schema the exeption is fired.

Screenshots/recordings

No response

Superset version

4.0.1

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented May 17, 2024

The error you're encountering, "AttributeError: 'bool' object has no attribute 'strip'", suggests that a boolean value is being passed to a method that expects a string, specifically within the get_columns method of the pyhive.sqlalchemy_hive module. This issue arises when Superset tries to retrieve the table schema from your Hive server through the Flink SQL Gateway.

To address this issue, consider the following steps:

  1. Review the Data Types: Ensure that the data passed into methods expecting strings are indeed strings. This might require checking the code that interfaces with the Hive server for any data type mismatches.

  2. Data Conversion: Before calling methods that operate on strings (like .strip()), verify the data type of the variable and convert it to a string if necessary.

  3. Superset and PyHive Versions: Ensure you're using the latest versions of Superset and PyHive, as updates may contain fixes for this issue. If the problem persists, consider reporting it to the Superset GitHub repository.

  4. Custom Code Checks: If you have custom code or plugins in Superset for interfacing with the Hive server, add explicit checks to handle or convert non-string types before they are processed further.

This approach targets the specific error by ensuring type compatibility and applying necessary updates or patches. For more detailed guidance, reviewing the Superset codebase and the PyHive documentation might provide additional insights.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added data:connect:hive Related to Hive global:error Related to global errors affecting the platform sqllab Namespace | Anything related to the SQL Lab labels May 17, 2024
@rusackas rusackas removed the global:error Related to global errors affecting the platform label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect:hive Related to Hive sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

No branches or pull requests

2 participants