-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ADAP-593] [Bug] Inconsistent key format for key pair authentication from file vs env variable #640
Comments
Wanted to also mention that the dbt Snowflake with key pair authentication from environment variable works fine if the BEGIN and END parts are missing from the key. |
@az-hienas hear me out, do you think that #619 is asking for the same thing? What's great is that @gabeschenz even provides some sample code that would enable what you both are asking for afaik, there's two standard formats for private keys (or so SO tells me):
#292 added support for duplicate of: #619 lmk if you'd rather keep it open! p.s. dbt-bigquery has the opposite problem! |
Hi @dataders , apologies for the late reply. As far as I know for dbt key pair authentication where the private is in a file , using So I think it's more about consistency. Either support both or support the same one for I would keep this issue open. Just my two cents on this. |
I agree with @az-hienas. It seems odd that it can only be DER if using an environment variable, and can only be PEM if using a file. Why not a DER file or a PEM environment variable? I have an open PR to allow the use of a PEM environment variable: #671 |
Is this a new bug in dbt-snowflake?
Current Behavior
I am using dbt-snowflake 1.5.0 with the key pair authentication where I get the private key from an environment variable, as implemented and merged in: #292 (Yes, I am aware that this is not documented at the time of me writing this).
When using dbt with private key from env (
private_key
property inprofiles.yml
) if the key is of the form:then I get an error:
It works fine if I use a private key file that has the same above format with BEGIN and END.
The usage of
is also needed for Python to work with Snowflake as shown at:
https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#using-key-pair-authentication-key-pair-rotation
If I don't include the BEGIN and END parts in the key then both Python (key pair authentication) and dbt (with key pair authentication from file) fail with similar errors like:
The tests used in: #292 , namely in: https://github.com/dbt-labs/dbt-snowflake/pull/292/files#diff-9aa9bb0303b227925dba4a2525865f635633a375650c1c0f6aefdaeee0b851de
have examples of keys that don't have the BEGIN and END parts.
Expected Behavior
dbt Snowflake key pair authentication from environment variable should work with the same types of keys as the dbt Snowflake key pair authentication from a key file. Namely both methods of dbt Snowflake key pair authentication should work with keys of the form:
The Snowflake documentation for Python connectors using key pair authentication at:
https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#using-key-pair-authentication-key-pair-rotation
also use keys of the form:
and fails if the BEGIN and END parts are missing.
Steps To Reproduce
Example of
profiles.yml
and private key of the form:
For the above profile and key any
dbt test
ordbt run
command will fail with the error:Relevant log output
No response
Environment
Additional Context
No response
The text was updated successfully, but these errors were encountered: