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

SQL Lab Error 'str' object has no attribute 'set' #29611

Open
2 of 3 tasks
deviardn opened this issue Jul 17, 2024 · 5 comments
Open
2 of 3 tasks

SQL Lab Error 'str' object has no attribute 'set' #29611

deviardn opened this issue Jul 17, 2024 · 5 comments
Labels
data:connect:mssql Related to MSSSQL sqllab Namespace | Anything related to the SQL Lab

Comments

@deviardn
Copy link

Bug description

Sorry, my English is not good. I am using apache superset version 4.0.2. I tried using the SQL Lab menu, I got an error like in the picture. what do I have to do? Thank You
apache_superset_4_2

How to reproduce the bug

  1. Login to apache superset
  2. Click sql lab menu
  3. Select database and table
  4. Error

Screenshots/recordings

No response

Superset version

4.0.2

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.
@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Jul 17, 2024
Copy link

dosubot bot commented Jul 17, 2024

Hey @deviardn! 👋 I'm here to help you with any bugs, questions, or contributions you have while waiting for a human maintainer. Let's squash those bugs together!

To resolve the "Microsoft SQL Server Error: 'str' object has no attribute 'set'" error in Apache Superset version 4.0.2 when using the SQL Lab menu, you should apply the fix from the pull request #27577 which addresses issues with SQL Server in the sqlglot library.

Here is the relevant fix:

# Ensure you have the latest version of sqlglot that includes the fix for SQL Server.
# You can update sqlglot by running:
pip install --upgrade sqlglot

This update should resolve the error by ensuring that the correct handling for SQL Server is applied [1].

To continue talking to Dosu, mention @dosu.

@rusackas rusackas added the data:connect:mssql Related to MSSSQL label Jul 17, 2024
@fzhan
Copy link

fzhan commented Aug 5, 2024

Not sure if it's related or the same issue to the issue I'm facing:
#29853

@rusackas
Copy link
Member

rusackas commented Aug 5, 2024

If these are the same, let's close one in favor of the other.

@fzhan
Copy link

fzhan commented Aug 6, 2024

@rusackas I've tested the suggestion with sqlglot, it's not the same issue.

@fzhan
Copy link

fzhan commented Sep 6, 2024

I have captured the error log here:

2024-09-06 02:07:16,653:INFO:superset.sql_lab:Query 970: Executing 1 statement(s)
Query 970: Set query to 'running'
2024-09-06 02:07:16,653:INFO:superset.sql_lab:Query 970: Set query to 'running'
Query 970: Running statement 1 out of 1
2024-09-06 02:07:17,246:INFO:superset.sql_lab:Query 970: Running statement 1 out of 1
0.0.0.11 - - [06/Sep/2024:02:07:17 +0000] "POST /superset/log/?explode=events&dashboard_id=46 HTTP/1.1" 200 1 "https://superset.local/sqllab/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0"
2024-09-06 02:07:18,020:DEBUG:root:Query 970: Running query: select * from suppliers
LIMIT 1001
2024-09-06 02:07:18,035:DEBUG:root:Query 970: Handling cursor
Query 970: Storing results in results backend, key: 363e3e52-01cd-4938-b61a-1d0f6da2060a
2024-09-06 02:07:18,053:INFO:superset.sql_lab:Query 970: Storing results in results backend, key: 363e3e52-01cd-4938-b61a-1d0f6da2060a
0.0.0.11 - - [06/Sep/2024:02:07:18 +0000] "GET /api/v1/query/updated_since?q=(last_updated_ms:1725588358985) HTTP/1.1" 200 432 "https://superset.local/sqllab/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0"
SupersetErrorsException
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/views/base_api.py", line 127, in wraps
    raise ex
  File "/app/superset/views/base_api.py", line 121, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1470, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 93, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/utils/log.py", line 255, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/sqllab/api.py", line 409, in execute_sql_query
    command_result: CommandResult = command.run()
  File "/app/superset/commands/sql_lab/execute.py", line 121, in run
    raise ex
  File "/app/superset/commands/sql_lab/execute.py", line 103, in run
    status = self._run_sql_json_exec_from_scratch()
  File "/app/superset/commands/sql_lab/execute.py", line 163, in _run_sql_json_exec_from_scratch
    raise ex
  File "/app/superset/commands/sql_lab/execute.py", line 158, in _run_sql_json_exec_from_scratch
    return self._sql_json_executor.execute(
  File "/app/superset/sqllab/sql_json_executer.py", line 111, in execute
    raise SupersetErrorsException(
superset.exceptions.SupersetErrorsException: [SupersetError(message="int() argument must be a string, a bytes-like object or a real number, not 'set'", error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'MySQL', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
2024-09-06 02:07:18,423:WARNING:superset.views.base:SupersetErrorsException
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 95, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/views/base_api.py", line 127, in wraps
    raise ex
  File "/app/superset/views/base_api.py", line 121, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1470, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 93, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/utils/log.py", line 255, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/sqllab/api.py", line 409, in execute_sql_query
    command_result: CommandResult = command.run()
  File "/app/superset/commands/sql_lab/execute.py", line 121, in run
    raise ex
  File "/app/superset/commands/sql_lab/execute.py", line 103, in run
    status = self._run_sql_json_exec_from_scratch()
  File "/app/superset/commands/sql_lab/execute.py", line 163, in _run_sql_json_exec_from_scratch
    raise ex
  File "/app/superset/commands/sql_lab/execute.py", line 158, in _run_sql_json_exec_from_scratch
    return self._sql_json_executor.execute(
  File "/app/superset/sqllab/sql_json_executer.py", line 111, in execute
    raise SupersetErrorsException(
superset.exceptions.SupersetErrorsException: [SupersetError(message="int() argument must be a string, a bytes-like object or a real number, not 'set'", error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'MySQL', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
10.1.176.0 - - [06/Sep/2024:02:07:18 +0000] "POST /api/v1/sqllab/execute/ HTTP/1.1" 500 306 "https://superset.local/sqllab/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:connect:mssql Related to MSSSQL sqllab Namespace | Anything related to the SQL Lab
Projects
None yet
Development

No branches or pull requests

3 participants