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

When I use superset to query the connected odps database, the error ODPSEngineSpec.execute() takes 3 positional arguments but 4 were given #31641

Open
3 tasks done
yujun2021 opened this issue Dec 29, 2024 · 17 comments
Labels
sqllab Namespace | Anything related to the SQL Lab

Comments

@yujun2021
Copy link

Bug description

  1. when i query the connected odps database, the error is as follows
    image

  2. The detailed error log is as follows

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1469, 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 119, in wraps
    duration, response = time_function(f, self, *args, **kwargs)
  File "/app/superset/utils/core.py", line 1364, in time_function
    response = func(*args, **kwargs)
  File "/app/superset/views/base_api.py", line 91, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/utils/log.py", line 303, 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/utils/decorators.py", line 266, in wrapped
    return on_error(ex)
  File "/app/superset/utils/decorators.py", line 236, in on_error
    raise ex
  File "/app/superset/utils/decorators.py", line 259, in wrapped
    result = func(*args, **kwargs)
  File "/app/superset/commands/sql_lab/execute.py", line 105, in run
    status = self._run_sql_json_exec_from_scratch()
  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='odps error: ODPSEngineSpec.execute() takes 3 positional arguments but 4 were given', error_type=, level=, extra={'engine_name': 'ODPS', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
  1. The relevant database and driver versions are as follows:
    image

Screenshots/recordings

No response

Superset version

4.1.1

Python version

3.10

Node version

I don't know

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 Dec 29, 2024

@yujun2021 Hello there! I'm Dosu, a bot here to help you with bug fixes, questions, and becoming a contributor. Let's tackle this issue together while we wait for a human maintainer.

The error you're encountering indicates that the ODPSEngineSpec.execute() method is being called with more arguments than it expects. This typically suggests a mismatch between the method's implementation and how it's being invoked.

To resolve this issue, you can try the following steps:

  1. Check the Method Signature: Verify the current implementation of the ODPSEngineSpec.execute() method in your Superset codebase. Ensure that the number of arguments being passed matches the method's signature.

  2. Review Recent Changes: If there have been recent updates to the Superset codebase or the ODPS-related packages (odps or pyodps), check if any changes might have affected the method signature or its usage.

  3. Compatibility: Ensure that the versions of Superset, odps, and pyodps you are using are compatible. Sometimes, version mismatches can lead to such issues.

  4. Custom Modifications: If there are any custom modifications or extensions in your Superset setup, review them to ensure they align with the expected method signatures.

If these steps do not resolve the issue, you may need to look into the specific implementation details of the ODPSEngineSpec class and how it interacts with the rest of the Superset codebase.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added the sqllab Namespace | Anything related to the SQL Lab label Dec 29, 2024
@AasmitPadea
Copy link

@dosu please assign this issue to me

@yujun2021
Copy link
Author

@dosu please assign this issue to me

Is there any solution?

Copy link

dosubot bot commented Dec 31, 2024

Could you provide more details about any recent changes or updates made to your Superset setup or the ODPS-related packages? Additionally, are there any custom modifications in your Superset environment that might affect the ODPSEngineSpec.execute() method? This information could help in identifying the root cause of the issue.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@wjsi
Copy link

wjsi commented Jan 3, 2025

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

@yujun2021
Copy link
Author

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

  1. When I uninstalled the old version 0.12.1.1 of pyodps and installed the new version 0.12.2, the same error was reported. The details are as follows
    image

  2. I suspect there is something wrong with the way the connection is made, or pyodps doesn't really fix the error.
    image

@yujun2021
Copy link
Author

Anyone can help on this issue?

@wjsi
Copy link

wjsi commented Jan 7, 2025

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

  1. When I uninstalled the old version 0.12.1.1 of pyodps and installed the new version 0.12.2, the same error was reported. The details are as follows
    image
  2. I suspect there is something wrong with the way the connection is made, or pyodps doesn't really fix the error.
    image
image Works for me. Given the error message it is quite possible that the correct version is not properly installed for superset as the function signature is already correct for the latest version of superset.

@yujun2021
Copy link
Author

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

  1. When I uninstalled the old version 0.12.1.1 of pyodps and installed the new version 0.12.2, the same error was reported. The details are as follows
    image
  2. I suspect there is something wrong with the way the connection is made, or pyodps doesn't really fix the error.
    image

image Works for me. Given the error message it is quite possible that the correct version is not properly installed for superset as the function signature is already correct for the latest version of superset.

I'm curious how you deployed the superset service. I installed it through k8s helm chart, and then pip install pyodps==0.12.2; my superset version is 4.1.1

@yujun2021 yujun2021 reopened this Jan 7, 2025
@wjsi
Copy link

wjsi commented Jan 7, 2025

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

  1. When I uninstalled the old version 0.12.1.1 of pyodps and installed the new version 0.12.2, the same error was reported. The details are as follows
    image
  2. I suspect there is something wrong with the way the connection is made, or pyodps doesn't really fix the error.
    image

image Works for me. Given the error message it is quite possible that the correct version is not properly installed for superset as the function signature is already correct for the latest version of superset.

I'm curious how you deployed the superset service. I installed it through k8s helm chart, and then pip install pyodps==0.12.2; my superset version is 4.1.1

Installed with pip inside a virtualenv on host without any containers.

@yujun2021 yujun2021 reopened this Jan 11, 2025
@yujun2021
Copy link
Author

Should be resolved with PyODPS 0.12.2 release. See https://github.com/aliyun/aliyun-odps-python-sdk/releases/tag/v0.12.2 for details.

  1. When I uninstalled the old version 0.12.1.1 of pyodps and installed the new version 0.12.2, the same error was reported. The details are as follows
    image
  2. I suspect there is something wrong with the way the connection is made, or pyodps doesn't really fix the error.
    image

image Works for me. Given the error message it is quite possible that the correct version is not properly installed for superset as the function signature is already correct for the latest version of superset.

I'm curious how you deployed the superset service. I installed it through k8s helm chart, and then pip install pyodps==0.12.2; my superset version is 4.1.1

Installed with pip inside a virtualenv on host without any containers.

1)The above problem has been solved!thank you very much!
2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation
image

image

@wjsi
Copy link

wjsi commented Jan 13, 2025

... conversation omitted ...

1)The above problem has been solved!thank you very much! 2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation image

image

It cannot be resolved currently as Superset points to the base db engine spec instead of the customized one when running SQL statements to obtain database meta. It might be resolved when MaxCompute is added to dialects of sqlglot but this absolutely takes time.

@yujun2021
Copy link
Author

... conversation omitted ...

1)The above problem has been solved!thank you very much! 2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation image
image

It cannot be resolved currently as Superset points to the base db engine spec instead of the customized one when running SQL statements to obtain database meta. It might be resolved when MaxCompute is added to dialects of sqlglot but this absolutely takes time.

It would be great if these problems could be solved, do we have any plans to solve these problems?

@wjsi
Copy link

wjsi commented Jan 17, 2025

... conversation omitted ...

1)The above problem has been solved!thank you very much! 2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation image
image

It cannot be resolved currently as Superset points to the base db engine spec instead of the customized one when running SQL statements to obtain database meta. It might be resolved when MaxCompute is added to dialects of sqlglot but this absolutely takes time.

It would be great if these problems could be solved, do we have any plans to solve these problems?

It takes time and will not be resolved right now.

@yujun2021
Copy link
Author

yujun2021 commented Jan 17, 2025

... conversation omitted ...

1)The above problem has been solved!thank you very much! 2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation image
image

It cannot be resolved currently as Superset points to the base db engine spec instead of the customized one when running SQL statements to obtain database meta. It might be resolved when MaxCompute is added to dialects of sqlglot but this absolutely takes time.

It would be great if these problems could be solved, do we have any plans to solve these problems?

It takes time and will not be resolved right now.

1) When I was about to save the data set, I found that I couldn't get an error.
Image

2)Loading the data set will also report an error
Image

@yujun2021 yujun2021 reopened this Jan 17, 2025
@yujun2021
Copy link
Author

... conversation omitted ...

1)The above problem has been solved!thank you very much! 2)A new problem has arisen. Although I can query the data of the odps database, I cannot obtain the metadata of the database table, such as column and field information. the following situation image
image

It cannot be resolved currently as Superset points to the base db engine spec instead of the customized one when running SQL statements to obtain database meta. It might be resolved when MaxCompute is added to dialects of sqlglot but this absolutely takes time.

It would be great if these problems could be solved, do we have any plans to solve these problems?

It takes time and will not be resolved right now.

I encountered two problems when using superset to connect to the odps database

  1. The odps data set cannot be created successfully.

Image

  1. odps metadata information and column names cannot be displayed
    Image
    I hope as follows
    Image

3)My odps version is v0.12.2, superset version 4.1.1. I would be very grateful if there is a plan to correct these problems recently.

@yujun2021
Copy link
Author

2025-01-18 13:51:14,169:ERROR:flask_appbuilder.api:Error parsing near '' at line 2:14 Traceback (most recent call last): File "/app/superset/sql/parse.py", line 256, in _parse return sqlglot.parse(script, dialect=dialect) File "/usr/local/lib/python3.10/site-packages/sqlglot/__init__.py", line 102, in parse return Dialect.get_or_raise(read or dialect).parse(sql, **opts) File "/usr/local/lib/python3.10/site-packages/sqlglot/dialects/dialect.py", line 919, in parse return self.parser(**opts).parse(self.tokenize(sql), sql) File "/usr/local/lib/python3.10/site-packages/sqlglot/parser.py", line 1395, in parse return self._parse( File "/usr/local/lib/python3.10/site-packages/sqlglot/parser.py", line 1467, in _parse self.raise_error("Invalid expression / Unexpected token") File "/usr/local/lib/python3.10/site-packages/sqlglot/parser.py", line 1508, in raise_error raise error sqlglot.errors.ParseError: Invalid expression / Unexpected token. Line 2, Col: 14. SELECT * FROM default.播放action`
LIMIT 100

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/flask_appbuilder/api/init.py", line 111, in wraps
return f(self, *args, **kwargs)
File "/app/superset/views/base_api.py", line 119, in wraps
duration, response = time_function(f, self, *args, **kwargs)
File "/app/superset/utils/core.py", line 1364, in time_function
response = func(*args, **kwargs)
File "/app/superset/utils/log.py", line 303, in wrapper
value = f(*args, **kwargs)
File "/app/superset/views/base_api.py", line 91, in wraps
return f(self, *args, **kwargs)
File "/app/superset/datasets/api.py", line 338, in post
return self.response(201, id=new_model.id, result=item, data=new_model.data)
File "/app/superset/connectors/sqla/models.py", line 1416, in data
data_ = super().data
File "/app/superset/connectors/sqla/models.py", line 404, in data
"select_star": self.select_star,
File "/app/superset/connectors/sqla/models.py", line 1395, in select_star
return self.database.select_star(
File "/app/superset/models/core.py", line 719, in select_star
return self.db_engine_spec.select_star(
File "/app/superset/db_engine_specs/base.py", line 1689, in select_star
sql = SQLScript(sql, engine=cls.engine).format()
File "/app/superset/sql/parse.py", line 611, in init
self.statements = statement_class.split_script(script, engine)
File "/app/superset/sql/parse.py", line 316, in split_script
ast = cls._parse(remainder, engine)[0]
File "/app/superset/sql/parse.py", line 259, in _parse
raise SupersetParseError(
superset.exceptions.SupersetParseError: Error parsing near '`' at line 2:14

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

No branches or pull requests

3 participants