The purpose of this connector is to provide a simple way to connect to Snowflake. Currently, it is only used for internal purposes.
Clone the repository and go to the root directory:
git clone https://github.com/ronmorgen1/snowflake.git && cd snowflake
Run the setup script to install dependencies:
python setup.py install
create a python file named snowflake.py
and import the connector, use your credentials to connect:
Basic Query:
from Snowflake.snowflake import Snowflake
with Snowflake("<pagaya_email>", "<pagaya_password>") as conn:
res = conn.execute_simple("SELECT * FROM LOANS LIMIT 100")
print(res)
Run a query that returns a pandas dataframe:
from Snowflake.snowflake import Snowflake
with Snowflake("<pagaya_email>", "<pagaya_password>") as conn:
res = conn.execute_to_df("SELECT * FROM LOANS LIMIT 10;")
print(res)
From SQL File:
Create a file named query.sql
and write the query in it:
SELECT *
FROM LOANS
LIMIT 100;
Run the query from snowflake.py
:
from Snowflake.snowflake import Snowflake
with Snowflake("<pagaya_email>", "<pagaya_password>") as conn:
res = conn.execute_file('./query.sql')
print(res)