What is the Best Alternative to the 'snowflake.connector' Library for Connecting to Snowflake in Python?

This topic was automatically generated from Slack. You can find the original thread here.

Kyle : What’s the best way to connect to snowflake without using the snowflake library?

I get this error when I try to import it:

    import snowflake.connector
ModuleNotFoundError: No module named 'snowflake.connector'; 'snowflake' is not a package

I’d like to use snowflake inside a python step. Having it in a separate node.js step is holding the functionality of the workflow back a little bit.

Dylan Pierce : Hi Kyle,

Have you tried using the magic comment system in Python code steps?

This should help with these kinds of cases where the module name differs from the PyPi package name.

Adding this to the top of the Python code step might help:

# pipedream add-package snowflake-connector-python

Kyle : Doing this

# pipedream add-package snowflake-connector-python
import snowflake.connector

Got me the same error.

But I saw I might be able to connect to snowflake like in the screenshot. How would I create the engine or sql connection in that case? I.e. How do I call in that snowflake connection from the configuration section of the step?

Kyle : I think these docs were relevant, but it’s not working for me

Kyle :

Dylan Pierce : | But I saw I might be able to connect to snowflake like in the screenshot. How would I create the engine or sql connection in that case? I.e. How do I call in that snowflake connection from the configuration section of the step?

You can use the pd.inputs dictionary to reference the authentication credentials for snowflake or any connected app.

Here’s an example with Slack: Connecting apps in Python

Dylan Pierce : I’m also seeing an error with the Snowflake package, we’ll have to try a manual mapping in our backend.