donderdag 7 januari 2021

Using the Snowflake Python connector in a YAML pipeline


If you want to use the snowflake python connector in your pipeline you have to install the connector software on a agent. If you have a private agent it's only necessary once but on a public agent you need to install the software every time. If you don't do that, you will get an error in python :

ImportError: No module named snowflake.connector

##[error]The process '/usr/bin/python' failed with exit code 1


Installation of the Python connector in a YAML pipeline is fairly easy. There are a couple of steps :
  • Upgrade pip to the latest version.
  • Download the python connector.
  • Installation of the python connector.

Here is the script:

- script : | 
    python --version
    python -m pip install --upgrade pip
    python -m pip install -r
    python -m pip install snowflake-connector-python==2.1.3
  displayName: 'Install Snowflake connector'

This will download the software on the machine and you can use the connector in your python script.

Final thoughts

It was a bit of a surprise how simple it was to include this in my YAML pipeline. Now I can use the Snowflake python connector in my python scripts. Maybe that is for a future blogpost!


Geen opmerkingen:

Een reactie posten