Snowflake Connector for Python
Вставка
- Опубліковано 10 лют 2025
- You can get all snowflake Videos, PPTs, Queries, Interview questions and Practice files in my Udemy course for very less price.. I will be updating this content and will be uploading all new videos in this course.
My Snowflake Udemy Course:
www.udemy.com/...
I can be reachable on jana.snowflake2@gmail.com.
====================================
Step 1: Install Anaconda3 for Python from google
Step 2: Install Snowflake connector for Python, run below command from cmd prompt
pip install snowflake-connector-python==3.0.0
Step 3: Import that connector in your python program
Step 4: Use snowflake.connector.connect to connect to your snowflake account.
===============================
#!/usr/bin/env python
import snowflake.connector
import pandas as pd
import csv
from variables import *
sfconn = snowflake.connector.connect(
user=username, #user='your-username'
password=password, #password='your-password'
account='bb20395.ap-southeast-1' # your account id
)
sf = sfconn.cursor()
sf.execute("SELECT TABLE_SCHEMA, TABLE_NAME, ROW_COUNT from practice_data.INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG='PRACTICE_DATA' and TABLE_TYPE='BASE TABLE';")
counts = sf.fetchall()
print(counts)
df=pd.DataFrame(counts)
print(df)
with open('C:/Users/janar/OneDrive/Desktop/table_counts.csv', 'w', newline='') as file:
writer = csv.writer(file, delimiter='|')
writer.writerows(counts)
sf.close()
=========================
SELECT TABLE_NAME, ROW_COUNT from practice_data.INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='TPCH_SF10' and TABLE_TYPE='BASE TABLE';
SELECT TABLE_SCHEMA, TABLE_NAME, ROW_COUNT from practice_data.INFORMATION_SCHEMA.TABLES WHERE TABLE_CATALOG='PRACTICE_DATA' and TABLE_TYPE='BASE TABLE';
Thank you for the clear explanation.
Thank you, janardhan !
thanks bro
Hi Janrdan..that helped...can we have other examples like any transformation kind of thing we can do using pandas for snowflake? I mean what else we can do with python connector what we cant do using snowflake
Will do in future, now using python worksheet you can write code in snowflake directly, most of the pandas dataframe available in snowpark dataframes
How to export columnnames of that table into csv file.
I don't understand, please explain your requirement clearly.
Can we download more than 100mb data from snowflake using this connector?
Yes
Please ఆన్న python use చేసి snowflake coding ఎలా చెయ్యాలో చెప్పండి ఇంకా మరిన్ని videos ఆన్న please
I am also trying to learn the same :)
This video not there in udemy.plz adf
Will do