You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "xueyun0512 (via GitHub)" <gi...@apache.org> on 2026/01/20 10:08:00 UTC

[I] Superset not working with Druid sqlalchemy dialect [superset]

xueyun0512 opened a new issue, #37281:
URL: https://github.com/apache/superset/issues/37281

   ### Bug description
   
   I have change pydruid/db/api.py and pydruid/db/sqlalchemy.py for Kerberos Integration. It works fine on command line with only SQLAlchemy. Here's working code: 
   
   ```from sqlalchemy import *
   from sqlalchemy.engine import create_engine
   from sqlalchemy.schema import *
   conn_str=f"druid+https://@druid-router:9088/druid/v2/sql"
   engine = create_engine(
   	conn_str,
   	connect_args={
           "kerberos": True,
           "kerberos_principal": "toto%40DONUT.COM",
           "kerberos_password": "mypassword!",
           "kerberos_service": "HTTP"
           "ssl_verify_cert": False
       }
   )
   with engine.connect() as conn:
       result = conn.execute("SELECT DISTINCT TABLE_SCHEMA FROM INFORMATION_SCHEMA.TABLES")
       for row in result:
           print(row)
   ```
   **I've encoded the Kerberos Principal by replacing '@' with '%40'**
   
   However, on Superset, it fails with the following configuration:
   ```
   SQLAlchemy URL = druid+https://@druid-router:9088/druid/v2/sql
   
   In Advanced/Engine Parameters
   {"connect_args":{"kerberos":true,"kerberos_principal":"toto%40DONUT.COM","kerberos_password":"mypassword!","kerberos_service":"HTTP","ssl_verify_cert":false}}
   ```
   
   I got the following erro:
   ```WARNING:superset.views.error_handling:SupersetErrorsException
   Traceback (most recent call last):
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/commands/database/test_connection.py", line 176, in run
       raise DBAPIError(ex_str or None, None, None)
   sqlalchemy.exc.DBAPIError: (builtins.NoneType) None
   (Background on this error at: https://sqlalche.me/e/14/dbapi)
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/flask/app.py", line 1484, in full_dispatch_request
       rv = self.dispatch_request()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/flask/app.py", line 1469, in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
       return f(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/views/base_api.py", line 120, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/utils/core.py", line 1369, in time_function
       response = func(*args, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/utils/log.py", line 304, in wrapper
       value = f(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/views/base_api.py", line 92, in wraps
       return f(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/databases/api.py", line 1204, in test_connection
       TestConnectionDatabaseCommand(item).run()
     File "/opt/superset/.conda/envs/venv_superset/lib/python3.11/site-packages/superset/commands/database/test_connection.py", line 205, in run
       raise SupersetErrorsException(errors) from ex
   superset.exceptions.SupersetErrorsException: [SupersetError(message='(builtins.NoneType) None\n(Background on this error at: https://sqlalche.me/e/14/dbapi)', error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Apache Druid', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})]```
   
   Can someone help me please?
   Thanks you so much!!!
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   5.0.0
   
   ### Python version
   
   3.11
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [x] 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Superset not working with Druid sqlalchemy dialect [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #37281:
URL: https://github.com/apache/superset/issues/37281#issuecomment-3772074806

   <!-- Answer -->
   Superset uses the system-installed pydruid package, so if your patched version is installed in the same Python environment as Superset, it should be used for Druid connections ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/__init__.py#L61-L167)). The connection parameters you set in the UI's Advanced/Engine Parameters are passed through to SQLAlchemy, and the Druid engine spec does not filter or modify Kerberos-related connect_args—only SSL parameters if a server certificate is present ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/druid.py#L20-L141)).
   
   The generic DBAPIError with NoneType you see means the underlying exception wasn't properly propagated or logged, which can happen if the error message is empty or lost in the connection test flow ([source](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/database/test_connection.py#L63-L226)). This makes debugging tricky.
   
   Here are some targeted steps to help you troubleshoot:
   
   1. **Double-check your Python environment:** Make sure Superset and your CLI test are running in the exact same environment (same Python, same pydruid install, same dependencies).
   2. **Validate your connect_args structure:** In Superset, try placing your connect_args inside the `engine_params` block in the "Extras" field, like:
      ```json
      {
        "engine_params": {
          "connect_args": {
            "kerberos": true,
            "kerberos_principal": "toto%40DONUT.COM",
            "kerberos_password": "mypassword!",
            "kerberos_service": "HTTP",
            "ssl_verify_cert": false
          }
        }
      }
      ```
      This matches how Superset expects advanced parameters for Druid.
   3. **Check for environment differences:** Kerberos can depend on environment variables (like `KRB5_CONFIG`, `KRB5CCNAME`, etc.). Make sure these are set identically in both your CLI and the Superset process.
   4. **Increase logging:** If possible, run Superset with debug logging or check the Superset server logs for any additional error details that might not surface in the UI.
   
   If you still get the generic error, try a minimal connect_args (just `{"scheme": "https", "ssl_verify_cert": false}`) to confirm basic connectivity, then add Kerberos parameters one by one.
   
   Let me know what you find—if you get a more detailed error message in the logs, that will help narrow things down!
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6bcad6f6-6604-461a-b5ba-fd127937d167?feedback_type=other)</sup>
   
   [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Superset%20uses%20the%20system-installed%20pydruid%20package%2C%20so%20if%20your%20patched%20version%20is%20installed%20in%20the%20same%20Python%20environment%20as%20Superset%2C%20it%20should%20be%20used%20for%20Druid%20connections%C2%A0%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/__init__.py%23L61-L167%29%29.%20The%20connection%20parameters%20you%20set%20in%20the%20UI%27s%20Advanced/Engine%20Parameters%20are%20passed%20through%20to%20SQLAlchemy%2C%20and%20the%20Druid%20engine%20spec%20does%20not%20filter%20or%20modify%20Kerberos-related%20connect_args%E2%80%94only%20SSL%20parameters%20if%20a%20server%20certificate%20is%20present%C2%A0%28%5Bsource%5D%28https%3A//github
 .com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/db_engine_specs/druid.py%23L20-L141%29%29.%0A%0AThe%20generic%20DBAPIError%20with%20NoneType%20you%20see%20means%20the%20underlying%20exception%20wasn%27t%20properly%20propagated%20or%20logged%2C%20which%20can%20happen%20if%20the%20error%20message%20is%20empty%20or%20lost%20in%20the%20connection%20test%20flow%C2%A0%28%5Bsource%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/database/test_connection.py%23L63-L226%29%29.%20This%20makes%20debugging%20tricky.%0A%0AHere%20are%20some%20targeted%20steps%20to%20help%20you%20troubleshoot%3A%0A%0A1.%20%2A%2ADouble-check%20your%20Python%20environment%3A%2A%2A%20Make%20sure%20Superset%20and%20your%20CLI%20test%20are%20running%20in%20the%20exact%20same%20environment%20%28same%20Python%2C%20same%20pydruid%20install%2C%20same%20dependencies%29.%0A2.%20%2A%2AValidate%20your%20connect_args%20structure%3A%2A%2A%20In%20
 Superset%2C%20try%20placing%20your%20connect_args%20inside%20the%20%60engine_params%60%20block%20in%20the%20%22Extras%22%20field%2C%20like%3A%0A%20%20%20%60%60%60json%0A%20%20%20%7B%0A%20%20%20%20%20%22engine_params%22%3A%20%7B%0A%20%20%20%20%20%20%20%22connect_args%22%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%22kerberos%22%3A%20true%2C%0A%20%20%20%20%20%20%20%20%20%22kerberos_principal%22%3A%20%22toto%2540DONUT.COM%22%2C%0A%20%20%20%20%20%20%20%20%20%22kerberos_password%22%3A%20%22mypassword%21%22%2C%0A%20%20%20%20%20%20%20%20%20%22kerberos_service%22%3A%20%22HTTP%22%2C%0A%20%20%20%20%20%20%20%20%20%22ssl_verify_cert%22%3A%20false%0A%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%7D%0A%20%20%20%7D%0A%20%20%20%60%60%60%0A%20%20%20This%20matches%20how%20Superset%20expects%20advanced%20parameters%20for%20Druid.%0A3.%20%2A%2ACheck%20for%20environment%20differences%3A%2A%2A%20Kerberos%20can%20depend%20on%20environment%20variables%20%28like%20%60KRB5_CONFIG%60%2C%20%60KRB5CCNAME%60%2C%20etc.%29.
 %20Make%20sure%20these%20are%20set%20identically%20in%20both%20your%20CLI%20and%20the%20Superset%20process.%0A4.%20%2A%2AIncrease%20logging%3A%2A%2A%20If%20possible%2C%20run%20Superset%20with%20debug%20logging%20or%20check%20the%20Superset%20server%20logs%20for%20any%20additional%20error%20details%20that%20might%20not%20surface%20in%20the%20UI.%0A%0AIf%20you%20still%20get%20the%20generic%20error%2C%20try%20a%20minimal%20connect_args%20%28just%20%60%7B%22scheme%22%3A%20%22https%22%2C%20%22ssl_verify_cert%22%3A%20false%7D%60%29%20to%20confirm%20basic%20connectivity%2C%20then%20add%20Kerberos%20parameters%20one%20by%20one.%0A%0ALet%20me%20know%20what%20you%20find%E2%80%94if%20you%20get%20a%20more%20detailed%20error%20message%20in%20the%20logs%2C%20that%20will%20help%20narrow%20things%20down%21)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-bla
 ck)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37281)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Superset not working with Druid sqlalchemy dialect [superset]

Posted by "xueyun0512 (via GitHub)" <gi...@apache.org>.
xueyun0512 closed issue #37281: Superset not working with Druid sqlalchemy dialect
URL: https://github.com/apache/superset/issues/37281


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Superset not working with Druid sqlalchemy dialect [superset]

Posted by "xueyun0512 (via GitHub)" <gi...@apache.org>.
xueyun0512 commented on issue #37281:
URL: https://github.com/apache/superset/issues/37281#issuecomment-3772349615

   Just add the variable KRB5_CONFIG is it's okay now!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org