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

<!-- Answer -->
This error happens because configparser sees the % in your percent-encoded 
password (like %40 for @) and tries to interpolate it, which causes the 
ValueError. Superset’s Alembic migration code is supposed to escape % to %% 
automatically, but if you’re still seeing this, it’s usually because:

- The password is already percent-encoded before it gets to superset_config.py 
and then gets encoded again (double encoding, e.g., %2540 instead of %40).
- Or, you’re running an older Superset version where Alembic doesn’t escape % 
in the URI.

**How to fix:**

1. **Store the raw, unencoded password** in your Kubernetes secret (e.g., 
`JjJ0Fkk@rEP$UlHr`).
2. **In superset_config.py**, use Python’s `urllib.parse.quote_plus` to encode 
the username and password at runtime:

   ```python
   import os
   from urllib.parse import quote_plus

   DB_USER = os.getenv("DB_USER")
   DB_PASS = os.getenv("DB_PASS")
   DB_HOST = os.getenv("DB_HOST")
   DB_PORT = os.getenv("DB_PORT")
   DB_NAME = os.getenv("DB_NAME")

   SQLALCHEMY_DATABASE_URI = (
       
f"postgresql+psycopg2://{quote_plus(DB_USER)}:{quote_plus(DB_PASS)}@{DB_HOST}:{DB_PORT}/{DB_NAME}?sslmode=require"
   )
   ```

3. **Do not percent-encode the password in the secret or values.yaml**—let 
Python handle it at runtime. If you encode it twice, you’ll get errors like 
`%2540` instead of `%40`, which breaks the connection string and triggers 
configparser errors 
([reference](https://github.com/apache/superset/issues/32266)).

4. **Make sure you’re running a recent Superset version** (4.x or later), where 
Alembic migration code escapes % for configparser 
([reference](https://github.com/apache/superset/blob/2e9939baf253e607a54722b1996baaf625e72133/superset/migrations/env.py)).

If you still see the error, check that your secret contains the raw password, 
not an encoded one, and that you’re not double-encoding anywhere in your 
pipeline. If you’re on an older Superset version, consider upgrading.

Let me know if you want a full working example or if you’re still stuck after 
these changes!


<!-- 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/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=great_response)
 | 
[Irrelevant](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=irrelevant_answer)
 | 
[Incorrect](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=incorrect_sources)
 | 
[Verbose](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=too_verbose)
 | 
[Hallucination](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=hallucination)
 | [Report 
🐛](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?feedback_type=bug_report)
 | 
[Other](https://app.dosu.dev/response-feedback/d8450b3f-b9b2-4e24-9efa-4f499d45a194?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-13614379

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