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

Here's the final version with a request for community help at the end:

---

**Title: Issue with loading SSASEngineSpec - "Could not load database driver: 
SSASEngineSpec"**

Hi Apache Superset team,

I am working on adding support for **SQL Server Analysis Services (SSAS)** to 
Superset. I have implemented a new class called `SSASEngineSpec` as needed, but 
I am encountering the following error:

```
ERROR: Could not load database driver: SSASEngineSpec
```

### The code I implemented:
```python
from typing import Any, Optional
from datetime import datetime
from superset.db_engine_specs.base import BaseEngineSpec

class SSASEngineSpec(BaseEngineSpec):
    engine = "ssas"
    engine_name = "SQL Server Analysis Services"
    
    @classmethod
    def execute(cls, cursor: Any, query: str, **kwargs: Any) -> Any:
        cursor.execute(query)
        return cursor.fetchall()
    
    @classmethod
    def get_dimensions(cls, cursor: Any) -> list[tuple[Any, ...]]:
        cursor.execute("SELECT * FROM $system.DISCOVER_DIMENSIONS")
        return cursor.fetchall()

    @classmethod
    def get_databases(cls, cursor: Any) -> list[tuple[Any, ...]]:
        cursor.execute("SELECT * FROM $system.DISCOVER_CATALOGS")
        return cursor.fetchall()
    
    @classmethod
    def convert_dttm(cls, target_type: str, dttm: datetime) -> Optional[str]:
        return f"'{dttm.isoformat()}'"
    
    @classmethod
    def fetch_data(cls, cursor: Any, limit: Optional[int] = None) -> 
list[tuple[Any, ...]]:
        if not cursor.description:
            return []
        return super().fetch_data(cursor, limit)
```

### My questions:
1. Is there something I am missing regarding how to register or load this class?
2. Do any configuration changes need to be made (e.g., `superset_config.py` or 
similar) to load this new driver correctly?
3. Are there any guidelines or documentation for adding SSAS support?

Additionally, I am trying to connect to SSAS using the following connection 
string format:

```
ssas://ip/ssas_dbname
```

Does this format look correct for SSAS connections in Superset?

I would greatly appreciate any guidance or documentation on resolving this 
error.

### Help from the community:
If anyone in the community has experience integrating SSAS with Superset, your 
input would be incredibly valuable. Any code samples, documentation, or 
suggestions to help resolve this issue would benefit not just me, but other 
developers looking to add SSAS support to Superset as well.

Thank you for your time and assistance!


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

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