GitHub user dosubot[bot] 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

<!-- Answer -->
To correctly configure the SSAS connection in Apache Superset for domain user 
authentication using Kerberos or LDAP, and ensure the connection is fully 
registered and usable, follow these steps:

### 1. Install the Required Database Driver
Ensure you have the necessary driver for SSAS. Since SSAS is not explicitly 
listed, you may need to find a compatible SQLAlchemy dialect and Python driver 
for SSAS.

### 2. Configure Kerberos Authentication
In the `Secure Extra` field of the database connection configuration, add the 
following JSON configuration for Kerberos authentication:

```json
{
    "auth_method": "kerberos",
    "auth_params": {
        "service_name": "superset",
        "config": "/path/to/krb5.config"
    }
}
```

Ensure you have the `trino[kerberos]` or `trino[all]` package installed:

```bash
pip install trino[kerberos]
```

### 3. Configure LDAP Authentication
If you prefer LDAP, you will need to configure it similarly in the `Secure 
Extra` field. However, specific details for LDAP configuration are not provided 
in the given context.

### 4. Register the Connection
After configuring the authentication, register the connection through the 
Superset web UI:
- Go to **Settings -> Data: Database Connections**.
- Click the **+DATABASE** button.
- Fill in the connection details, including the connection string and the 
`Secure Extra` field.

### 5. Display the Entire SSAS Data
Once the connection is successfully tested and saved, Superset should be able 
to display all databases and dimensions available in SSAS to the authenticated 
user.

### Example Configuration for Kerberos in the `Secure Extra` Field
```json
{
    "auth_method": "kerberos",
    "auth_params": {
        "service_name": "superset",
        "config": "/path/to/krb5.config"
    }
}
```

Ensure the connection string and other parameters are correctly set according 
to the SSAS driver documentation 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/databases.mdx)</sup>.

### Custom DB Engine Spec Implementation
Your custom DB engine spec for SSAS looks good. Ensure you have implemented the 
necessary methods and attributes to support metadata fetching and query 
execution. Here are some key methods and attributes you might need:

#### Methods:
- `fetch_metadata`: Fetch metadata from the database.
- `execute`: Execute SQL queries against the database.
- `get_dimensions`: Fetch dimensions from SSAS.
- `get_databases`: Fetch databases from SSAS.

#### Attributes:
- `engine`: Specifies the engine type.
- `engine_name`: Specifies the engine name.

### Example Custom DB Engine Spec
```python
from superset.db_engine_specs.base import BaseEngineSpec

class SSASEngineSpec(BaseEngineSpec):
    engine = 'ssas'
    engine_name = 'SQL Server Analysis Services'

    @classmethod
    def execute(cls, cursor, query, **kwargs):
        cursor.execute(query)
        return cursor.fetchall()

    @classmethod
    def get_dimensions(cls, cursor):
        cursor.execute("SELECT * FROM $system.DISCOVER_DIMENSIONS")
        return cursor.fetchall()

    @classmethod
    def get_databases(cls, cursor):
        cursor.execute("SELECT * FROM $system.DISCOVER_CATALOGS")
        return cursor.fetchall()
```

### Register the New Engine Spec
Add the new engine spec to the list of supported engines in Superset:

```python
# superset/config.py

from superset.db_engine_specs.ssas import SSASEngineSpec

DATABASES = {
    'ssas': SSASEngineSpec,
    # other database specs
}
```

By following these steps, you should be able to configure the SSAS connection 
in Superset for domain user authentication, register the connection, and 
display the entire SSAS data to the user upon successful authentication 
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/databases.mdx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/db_engine_specs/__init__.py)</sup>.


<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*


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

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