cesar-loadsmart opened a new issue, #23251:
URL: https://github.com/apache/superset/issues/23251

   I've followed this 
[doc](https://superset.apache.org/docs/databases/sql-server/) to connect 
Superset with a Microsoft SQL Server Database, but using the recommended 
connection string 
`mssql+pymssql://<Username>:<Password>@<Host>:<Port-default:1433>/<Database 
Name>/?Encrypt=yes` did not work: 
   <img width="846" alt="image" 
src="https://user-images.githubusercontent.com/89807801/222209478-0cd5302b-669c-45f3-9a33-602605a39de8.png";>
   
   Logs are also unclear: 
   
   ```
    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 1499, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1485, 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': 'Azure Synapse', 'issue_codes': [{'code': 1002, 
'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   2023-03-01 13:09:04,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 1499, in 
full_dispatch_request
       rv = self.dispatch_request()
     File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1485, 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': 'Azure Synapse', 'issue_codes': [{'code': 1002, 
'message': 'Issue 1002 - The database returned an unexpected error.'}]})]
   ```
   
   So, I tested some different connections string, the following two worked:
   
    `mssql+pymssql://<user>:<password>@<host>/?charset=utf8`
   
   `mssql+pymssql://<user>:<password>@<host>:<port>`
   
   However, when checking the Database schema on SQL Lab, it only shows the 
system tables:
   
![image](https://user-images.githubusercontent.com/89807801/222218294-9c8ae1e4-0a32-4b01-be8d-55f74550d295.png)
   
   It's not a permissions problem, because it works on Dbeaver!
   Queries also work, by specifying the complete path such as: `select * from 
db_name.dbo.table_name;`
   
   **The only problem is the fact that it is only displaying system tables and 
views.** 
   
   #### How to reproduce the bug
   
   1. Go to Databases tab
   2. Create a new database connection using pymssql
   3. By using the default connection string, you should receive an error 
message.
   4. See error
   5. Try using my suggested connection string, it may work, but you will only 
see system tables at the SQL Lab.
   
   ### Expected results
   
   Show all tables inside the database
   
   ### Actual results
   
   Only shows system tables, such as: 
   
![image](https://user-images.githubusercontent.com/89807801/222218294-9c8ae1e4-0a32-4b01-be8d-55f74550d295.png)
   
   
   ### Environment
   
   - browser type and version: Chrome Version 110.0.5481.100 (Official Build) 
(x86_64), but the same happens for all browsers
   - superset version: `2.0.0`
   -  lib version: `pymssql==2.2.7` 
   - python version: `3.8`
   - node.js version: `node 16`
   - any feature flags active: ALERT_REPORTS, DASHBOARD_NATIVE_FILTERS, 
ENABLE_TEMPLATE_PROCESSING
   - My Superset is running via Kubernetes
   
   ### 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.
   - [ ] 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
   
   This is not a database we own, so some tests would require getting in 
contact with the external provider, something We wouldn't like to do at this 
moment.
   


-- 
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