GitHub user ishirvani added a comment to the discussion: Add Support for SQL 
Server Analysis Services (SSAS) Connection with MDX Query Execution, Dimension 
Management, Pivot Tables, and Domain User Login



**Title**: "Could not load database driver: SSASEngineSpec" after defining and 
registering custom engine for SSAS

**Body**:
Hi,

I am facing an issue with adding support for SQL Server Analysis Services 
(SSAS) to Apache Superset. Despite following the necessary steps to define and 
register the `SSASEngineSpec` class, I am encountering the following error:

**Error**:
```
Could not load database driver: SSASEngineSpec
```

### What I've Done:
1. **Defined the SSASEngineSpec Class**:
   - Created the `SSASEngineSpec` class in `superset/db_engine_specs/ssas.py`, 
extending `BaseEngineSpec` with methods for executing MDX queries and managing 
dimensions and databases.

2. **Registered SSASEngineSpec**:
   - Updated `superset/db_engine_specs/__init__.py` to include `SSASEngineSpec` 
in the list of engine specs in the `load_engine_specs()` function.

3. **Connection String**:
   - Using the format `ssas://username:password@hostname/ssas_dbname
`.

### Logs:
Here are some relevant log entries when attempting to test the connection:

```
superset_app  | 2024-09-14 
08:36:08,301:DEBUG:superset.stats_logger:[stats_logger] (incr) 
test_connection_attempt
superset_app  | 2024-09-14 
08:36:08,319:DEBUG:superset.stats_logger:[stats_logger] (incr) 
test_connection_error.NoSuchModuleError
superset_app  | 2024-09-14 
08:36:08,322:DEBUG:superset.stats_logger:[stats_logger] (incr) 
DatabaseRestApi.test_connection.warning
superset_app  | 2024-09-14 
08:36:08,322:WARNING:superset.views.error_handling:CommandException
superset_app  | Traceback (most recent call last):
superset_app  |   File "/app/superset/commands/database/test_connection.py", 
line 143, in run
superset_app  |     with 
database.get_sqla_engine(override_ssh_tunnel=ssh_tunnel) as engine:
superset_app  |   File "/usr/local/lib/python3.10/contextlib.py", line 135, in 
__enter__
superset_app  |     return next(self.gen)
superset_app  |   File "/app/superset/models/core.py", line 446, in 
get_sqla_engine
superset_app  |     yield self._get_sqla_engine(
superset_app  |   File "/app/superset/models/core.py", line 465, in 
_get_sqla_engine
superset_app  |     self.db_engine_spec.validate_database_uri(sqlalchemy_url)
superset_app  |   File "/app/superset/db_engine_specs/base.py", line 2249, in 
validate_database_uri
superset_app  |     sqlalchemy_uri.get_driver_name(), set()
superset_app  |   File 
"/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 625, 
in get_driver_name
superset_app  |     return self.get_dialect().driver
superset_app  |   File 
"/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 680, 
in get_dialect
superset_app  |     entrypoint = self._get_entrypoint()
superset_app  |   File 
"/usr/local/lib/python3.10/site-packages/sqlalchemy/engine/url.py", line 662, 
in _get_entrypoint
superset_app  |     cls = registry.load(name)
superset_app  |   File 
"/usr/local/lib/python3.10/site-packages/sqlalchemy/util/langhelpers.py", line 
343, in load
superset_app  |     raise exc.NoSuchModuleError(
superset_app  | sqlalchemy.exc.NoSuchModuleError: Can't load plugin: 
sqlalchemy.dialects:ssas
superset_app  |
superset_app  | The above exception was the direct cause of the following 
exception:
superset_app  |
superset_app  | Traceback (most recent call last):
superset_app  |   File "/usr/local/lib/python3.10/site-packages/flask/app.py", 
line 1484, in full_dispatch_request
superset_app  |     rv = self.dispatch_request()
superset_app  |   File "/usr/local/lib/python3.10/site-packages/flask/app.py", 
line 1469, in dispatch_request
superset_app  |     return 
self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
superset_app  |   File 
"/usr/local/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py",
 line 95, in wraps
superset_app  |     return f(self, *args, **kwargs)
superset_app  |   File "/app/superset/views/base_api.py", line 119, in wraps
superset_app  |     duration, response = time_function(f, self, *args, **kwargs)
superset_app  |   File "/app/superset/utils/core.py", line 1364, in 
time_function
superset_app  |     response = func(*args, **kwargs)
superset_app  |   File "/app/superset/utils/log.py", line 303, in wrapper
superset_app  |     value = f(*args, **kwargs)
superset_app  |   File "/app/superset/views/base_api.py", line 91, in wraps
superset_app  |     return f(self, *args, **kwargs)
superset_app  |   File "/app/superset/databases/api.py", line 1219, in 
test_connection
superset_app  |     TestConnectionDatabaseCommand(item).run()
superset_app  |   File "/app/superset/commands/database/test_connection.py", 
line 193, in run
superset_app  |     raise DatabaseTestConnectionDriverError(
superset_app  | 
superset.commands.database.exceptions.DatabaseTestConnectionDriverError: Could 
not load database driver: SSASEngineSpec
superset_app  | 2024-09-14 08:36:08,329:INFO:werkzeug:172.18.0.1 - - 
[14/Sep/2024 08:36:08] "POST /api/v1/database/test_connection/ HTTP/1.1" 422 -
```

### Request:
I have confirmed that `SSASEngineSpec` is defined and registered according to 
the steps outlined in the documentation. However, the error persists. Could you 
provide any additional guidance or check if there might be something missed in 
the configuration or implementation? Any assistance would be greatly 
appreciated.

Thank you!

---



GitHub link: 
https://github.com/apache/superset/discussions/33093#discussioncomment-12797473

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


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

Reply via email to