GitHub user dosubot[bot] added a comment to the discussion: Production 
deployment issue in

<!-- Answer -->
To add MSSQL support to Superset in production on AKS, you need to build a 
custom Docker image that includes both the system-level ODBC libraries and the 
Python driver (pyodbc). The official Superset image does not include these by 
default—you must add them yourself for production reliability 
([reference](https://github.com/apache/superset/blob/057218d87ff3f2c8d2eb4a89d31a2b50e8a5c606/docs/docs/configuration/databases.mdx)).

**1. Create a custom Dockerfile:**

```dockerfile
FROM apache/superset:4.1.2

# Install system dependencies for ODBC and MSSQL
RUN apt-get update && \
    ACCEPT_EULA=Y apt-get install -y curl gnupg unixodbc-dev && \
    curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add - && \
    curl https://packages.microsoft.com/config/debian/12/prod.list > 
/etc/apt/sources.list.d/mssql-release.list && \
    apt-get update && \
    ACCEPT_EULA=Y apt-get install -y msodbcsql18 && \
    pip install --no-cache-dir pyodbc
```
(Adjust the Debian version if your base image uses a different one; check 
Microsoft's docs for the latest instructions.)

**2. Build and push your image:**
```sh
docker build -t <your-registry>/superset-mssql:4.1.2 .
docker push <your-registry>/superset-mssql:4.1.2
```

**3. Reference your image in Helm values.yaml:**
```yaml
image:
  repository: <your-registry>/superset-mssql
  tag: 4.1.2
  pullPolicy: Always
```

**4. Add MSSQL as a data source in Superset UI:**  
Once deployed, go to Data > Databases > + Database, and use a SQLAlchemy URI 
like:

```
mssql+pyodbc:///?odbc_connect=Driver%3D%7BODBC+Driver+18+for+SQL+Server%7D%3BServer%3D<your_server>%3BDatabase%3D<your_db>%3BUid%3D<your_user>%3BPwd%3D<your_password>%3BEncrypt%3Dyes%3BTrustServerCertificate%3Dno%3BConnection%20Timeout%3D30%3B
```
The value after `odbc_connect=` must be URL-encoded. You can use 
[urlencoder.org](https://www.urlencoder.org/) to encode the ODBC string.

**Best practices:**  
- Always build all required drivers into your image before deploying 
([reference](https://github.com/apache/superset/blob/057218d87ff3f2c8d2eb4a89d31a2b50e8a5c606/helm/superset/README.md)).
- Use Kubernetes secrets for credentials.
- For production, do not rely on runtime pip installs or bootstrap scripts for 
drivers—bake them into the image.

If you need to automate MSSQL connection setup, you can use Helm’s 
`extraConfigs` or `configOverrides` to mount a preconfigured database YAML or 
Python config.

Let me know if you need a full example or run into any build errors!


<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*

---
<sup>How did I do? 
[Good](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/70dcb34c-a1b7-466f-939a-68fff3aeb5d7?feedback_type=other)</sup>&nbsp;&nbsp;[![Join
 
Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Sh
 are on 
X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/33957)

GitHub link: 
https://github.com/apache/superset/discussions/33957#discussioncomment-13631389

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