getredash/redash · error · Exception

Neither password nor private_key_b64 is set.

Error message

Neither password nor private_key_b64 is set.

What it means

Raised by Snowflake._get_connection (redash/query_runner/snowflake.py:126) when the data source configuration has neither a password nor a private_key_b64 entry. The Snowflake connector requires one of these auth methods; if both are absent the runner cannot build connect() parameters and aborts before opening a connection.

Source

Thrown at redash/query_runner/snowflake.py:126

            "account": account,
            "region": region,
            "host": host,
            "application": "Redash/{} (Snowflake)".format(__version__.split("-")[0]),
        }

        if self.configuration.get("password"):
            params["password"] = self.configuration["password"]
        elif self.configuration.get("private_key_File"):
            private_key_b64 = self.configuration.get("private_key_File")
            private_key_bytes = b64decode(private_key_b64)
            if self.configuration.get("private_key_pwd"):
                private_key_pwd = self.configuration.get("private_key_pwd").encode()
            else:
                private_key_pwd = None
            private_key_pem = load_pem_private_key(private_key_bytes, private_key_pwd)
            params["private_key"] = private_key_pem
        else:
            raise Exception("Neither password nor private_key_b64 is set.")

        connection = snowflake.connector.connect(**params)

        return connection

    def _column_name(self, column_name):
        if self.configuration.get("lower_case_columns", False):
            return column_name.lower()

        return column_name

    def _parse_results(self, cursor):
        columns = self.fetch_columns(
            [(self._column_name(i[0]), self.determine_type(i[1], i[5])) for i in cursor.description]
        )
        rows = [dict(zip((column["name"] for column in columns), row)) for row in cursor]

        data = {"columns": columns, "rows": rows}

View on GitHub (pinned to ca79fe988d)

Solutions

  1. Set either password, or private_key_b64 containing the base64-encoded PEM private key (with optional private_key_pwd passphrase)
  2. For key auth: openssl genrsa, base64-encode the PEM, paste into private_key_b64, and ensure the public key is associated with the Snowflake user (RSA_PUBLIC_KEY)
  3. Re-save the data source and use Test Connection to confirm credentials are accepted

Example fix

# before
configuration: {account: 'xy123', user: 'ETL', password: ''}
# after
configuration: {account: 'xy123', user: 'ETL', private_key_b64: '<base64 pem>'}
Defensive patterns

Strategy: validation

Validate before calling

conf = ds.options
if not conf.get('password') and not conf.get('private_key_b64'):
    raise ValueError('Snowflake data source needs password or private_key_b64')

Try / catch

try:
    ds.query_runner.test_connection()
except Exception as e:
    return ok=False, message='Snowflake auth incomplete: {}'.format(e)

Prevention

When it happens

Trigger: Creating/running a Snowflake data source where password is blank and no RSA private key (base64) was supplied; also when key-based auth was half-configured (private_key_pwd set but private_key_b64 missing).

Common situations: Migrating from password to key-pair auth and clearing the password before saving the key; form submission dropping empty fields; copying a template configuration without filling secrets.

Related errors


AI-assisted analysis of getredash/redash@ca79fe988d (2026-08-28). Data as JSON: /api/errors/15d0a715f5cbfc9b. Report an issue: GitHub.