-
Notifications
You must be signed in to change notification settings - Fork 180
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
Issue with the SnowflakeEncryptedPrivateKeyPemProfileMapping #632
Comments
Hey @DanMawdsleyBA ! Just confirming, this is in 1.3.0a1, right? |
Looking again the current method uses the private key path but I am looking to use just the private key. I think the name may be confusing as we may need two methods for encrypted snowflake access: Renaming them to something like the below might make sense although would mean a breaking change from the early release
Unless there is a way to combine them into one @tatiana Any thoughts on how to best manage the above? |
@DanMawdsleyBA, well observed! I like your suggested names - we expose them in a new version and add a deprecation warning to the previous class, WDYT? This way, we won't be breaking users who may have adopted it, but we'll be encouraging and documenting the new way. Would you, by any chance, be able to contribute to this? |
Hey :) In documentation I found this method: https://astronomer.github.io/astronomer-cosmos/profiles/SnowflakeEncryptedPrivateKeyPem.html Here the DBT profile I need to set up to make it work: Would it be possible to add the profile with encryption back? Thanks :) |
So the documentation is from the pre-release version (Confused me as well at first) If you update to the 1.3.0a1 version you should see it. Although the name may change from the pre-release version to allow for 2 different methods : So for your case a new profile mapping: @tatiana just checking you're happy with that approach. I will do my best to find some time do you have a planned 1.3 release date? |
Okay thanks, I found a workaround to make it work while the release comes out: from airflow.hooks.base import BaseHook
from cosmos.profiles import SnowflakePrivateKeyPemProfileMapping
# Get the connection of snowflake
cnx = BaseHook.get_connection("snowflake_conn")
profile_mapping = SnowflakePrivateKeyPemProfileMapping(
conn_id="snowflake_conn",
profile_args={
"private_key_passphrase": cnx.get_password()
}
) Note: |
Why even use these mapping classes? Cosmos has a utility function from cosmos import ProfileConfig
from cosmos.profiles import get_automatic_profile_mapping
profile_mapping = get_automatic_profile_mapping(conn_id="snowflake_conn")
profile_config = ProfileConfig(
profile_name="profile_name",
profile_mapping=profile_mapping[0],
) |
@ivanstillfront I think the automated one choose the correct profile mapping behind the scenes so it would still need the profile mapping in the first place. I've tried @mattxxi workaround but I am getting an issue I think something to do with how the key gets decrypted error below: Saw this not sure if this is related to the key profile mapping: |
It's a valid question. The big reason is that using |
@jlaneve Airflow recommends using env vars to mock connections in ci/cd pipelines, see: https://airflow.apache.org/docs/apache-airflow/2.0.1/best-practices.html#mocking-variables-and-connections |
Hi @DanMawdsleyBA , sorry for the delay getting back to you - thank you very much for the PR! Yes, I'm happy with the approach. The profile mapping documentation is automated and unfortunately, we don't have versioned documentation yet. So, yes, I'm sorry for the confusion. We don't yet have a date for the 1.3 release - but we could release 1.3.0a2 with these changes, so you are not blocked, would that be fine? |
Yeah that would be great thanks! FYI the other issue I had was due to the fact 1.5.5 didn't support environment variables using the snowflake PEM key type. This is fixed in dbt-snowflake 1.7 |
@tatiana Would it be possible to get an alpha release for this so I can test? |
Hi @DanMawdsleyBA, sorry for the delay, we just cut the 1.3.0a2: |
That's great thanks! All seems to be working now :) Was great to meet you! |
…ronomer#649) Adds a snowflake mapping for encrypted private key using an environment variable Closes: astronomer#632 Breaking Change? This does rename the previous SnowflakeEncryptedPrivateKeyFilePemProfileMapping to SnowflakeEncryptedPrivateKeyFilePemProfileMapping but this makes it clearer as a new SnowflakeEncryptedPrivateKeyPemProfileMapping is added which supports the env variable. Also was only released as a pre-release change
With the new snowflake connection with an encrypted private key in the creation of the profile it misses out the "private_key" like how it does in in the non encrypted version.
The text was updated successfully, but these errors were encountered: