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

   I'm trying to connect Superset to a DuckDB database file.  I receive the 
following error:
   
   ```
   SupersetErrorsException
   Traceback (most recent call last):
     File "/app/superset/databases/commands/test_connection.py", line 120, in 
run
       raise DBAPIError(None, None, None)
   sqlalchemy.exc.DBAPIError: (builtins.NoneType) None
   (Background on this error at: http://sqlalche.me/e/13/dbapi)
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1502, in 
dispatch_request
       return 
self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
     File 
"/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py",
 line 89, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/views/base_api.py", line 113, in wraps
       raise ex
     File "/app/superset/views/base_api.py", line 110, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/app/superset/utils/core.py", line 1507, in time_function
       response = func(*args, **kwargs)
     File "/app/superset/utils/log.py", line 245, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/views/base_api.py", line 83, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/databases/api.py", line 709, in test_connection
       TestConnectionDatabaseCommand(g.user, item).run()
     File "/app/superset/databases/commands/test_connection.py", line 145, in 
run
       raise DatabaseTestConnectionFailedError(errors) from ex
   superset.databases.commands.exceptions.DatabaseTestConnectionFailedError: 
[SupersetError(message='(builtins.NoneType) None\n(Background on this error at: 
http://sqlalche.me/e/13/dbapi)', 
error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 
'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, 
extra={'engine_name': 'DuckDB', 'issue_codes': [{'code': 1002, 'message': 
'Issue 1002 - The database returned an unexpected error.'}]})]
   2023-03-31 10:57:26,232:WARNING:superset.views.base:SupersetErrorsException
   Traceback (most recent call last):
     File "/app/superset/databases/commands/test_connection.py", line 120, in 
run
       raise DBAPIError(None, None, None)
   sqlalchemy.exc.DBAPIError: (builtins.NoneType) None
   (Background on this error at: http://sqlalche.me/e/13/dbapi)
   
   The above exception was the direct cause of the following exception:
   
   Traceback (most recent call last):
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1516, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1502, in 
dispatch_request
       return 
self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
     File 
"/usr/local/lib/python3.8/site-packages/flask_appbuilder/security/decorators.py",
 line 89, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/views/base_api.py", line 113, in wraps
       raise ex
     File "/app/superset/views/base_api.py", line 110, in wraps
       duration, response = time_function(f, self, *args, **kwargs)
     File "/app/superset/utils/core.py", line 1507, in time_function
       response = func(*args, **kwargs)
     File "/app/superset/utils/log.py", line 245, in wrapper
       value = f(*args, **kwargs)
     File "/app/superset/views/base_api.py", line 83, in wraps
       return f(self, *args, **kwargs)
     File "/app/superset/databases/api.py", line 709, in test_connection
       TestConnectionDatabaseCommand(g.user, item).run()
     File "/app/superset/databases/commands/test_connection.py", line 145, in 
run
       raise DatabaseTestConnectionFailedError(errors) from ex
   superset.databases.commands.exceptions.DatabaseTestConnectionFailedError: 
[SupersetError(message='(builtins.NoneType) None\n(Background on this error at: 
http://sqlalche.me/e/13/dbapi)', 
error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 
'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, 
extra={'engine_name': 'DuckDB', 'issue_codes': [{'code': 1002, 'message': 
'Issue 1002 - The database returned an unexpected error.'}]})]
   ```
   #### How to reproduce the bug
   
   1. Go to Data => Databases
   2. Click `+ Database` and Select DuckDB from the dropdown list
   3. Enter 'duckdb:///app/tutorial.db'
   4. See error popup : An error occurred while creating databases: Connection 
failed, please check your connection settings
   
   Also, when creating the engine with the superset CLI
   
   ```superset set_database_uri -d duckdb  -u duckdb:///app/tutorial.duckdb```
   
   The same None Error Type appears.
   
   ### Expected results
   
   A DuckDB connection would be successfully create.
   
   ### Actual results
   
   An error is popped-up : An error occurred while creating databases: 
Connection failed, please check your connection settings
   
   #### Screenshots
   
   
![image](https://user-images.githubusercontent.com/10930578/229107159-ea9dc0bd-9459-4976-ac28-a216cdd9a278.png)
   
   
   ### Environment
   
   (please complete the following information):
   
   - browser type and version:  Firefox 111.0 (64-bit)
   - superset version: Superset 2.0.0 built from superset docker image
   - python version: Python 3.8.12
   - node.js version: `node -v` 
   - any feature flags active:
   
   
   ```
   FROM apache/superset:2.0.0 
   
   ARG SUPERSET_ADMIN
   ARG SUPERSET_PASSWORD
   ARG POSTGRES_USER
   ARG POSTGRES_PASSWORD
   # Switching to root to install the required packages
   USER root
   COPY --chown=superset:superset ./superset/assets/import .
   RUN pip install psycopg2-binary
   RUN pip install duckdb-engine
   RUN pip install duckdb
   USER superset
   RUN superset fab create-admin \
                 --username ${SUPERSET_ADMIN} \
                 --firstname Superset \
                 --lastname Admin \
                 --email [email protected] \
                 --password ${SUPERSET_PASSWORD}
   RUN superset db upgrade
   RUN superset init
   RUN superset set_database_uri -d OLTP  -u 
postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@oltp:5432/sales_oltp
   RUN superset set_database_uri -d DW  -u 
postgresql+psycopg2://${POSTGRES_USER}:${POSTGRES_PASSWORD}@dw:5432/sales_dw
   RUN superset import-dashboards -p ./dashboard.json
   
   ```
   
   
![image](https://user-images.githubusercontent.com/10930578/229108164-5d8a0add-a9b0-4c92-a427-10659c39a3d2.png)
   
   
   ### Checklist
   
   Make sure to follow these steps before submitting your issue - thank you!
   
   - [x] I have checked the superset logs for python stacktraces and included 
it here as text if there are any.
   - [x] I have reproduced the issue with at least the latest released version 
of superset.
   - [x] I have checked the issue tracker for the same issue and I haven't 
found one similar.
   
   ### Additional context
   
   Add any other context about the problem here.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to