[Python] Snowflake + SqlAlchemy + Alembic + OIDC

Discussão em 'Python' iniciado por Stack, Julho 30, 2025.

  1. Stack

    Stack Membro Participativo

    I'm currently implementing Alembic with SqlAlchemy models to manage database migrations to a Snowflake DB and we are using OIDC authentication for the connection to database, and I couldn't find a example of how to implement this type of connection to Alembic.

    It would be great if someone can give me an example of it

    def build_properties(self) -> str:
    auth, token = self._get_JWT_token()
    if not auth:
    raise PermissionError("No token")

    url = f"snowflake://{self.username}:mad:{self.account}/{self.database}/{self.schema}?warehouse={self.warehouse}&authenticator=oauth&token={token}"

    return url


    This is the code I have right now for generating the connection string, it doesn't work but is a start

    Continue reading...

Compartilhe esta Página