Naas Documentation
Naas.ai
GitHub
Slack Community
What's new?
Search…
Welcome to Naas
😎
Templates
AWS
Airtable
AlphaVantage
Bazimo
Boursorama
Bubble
CCXT
CSV
Canny
Celestrak
Cityfalcon
D-Tale
Dask
Data.gouv.fr
Draft Kings
EM-DAT
Elasticsearch
Excel
FAO
FEC
FTP
GitHub
Gmail
Google Analytics
Google Drive
Google Search
Google Sheets
HTML
Healthchecks
HubSpot
Hugging Face
IFTTT
IMDB
INPI
IUCN
Insee
Instagram
Integromat
Johns Hopkins
Jupyter
Jupyter Notebooks
LinkedIn
Matplotlib
Metrics Store
Microsoft Teams
Microsoft Word
MongoDB
MySQL
NASA
Naas
Naas Auth
Neo
Newsapi
Notion
OpenWeatherMap
OwnCloud
PDF
Pandas
Pillow
Pipedrive
Plaid
Plotly
PostgresSQL
PyPI
Python
Qonto
Quandl
Reddit
Redshift
Remoteok
Remotive
SAP-HANA
SendGrid
Slack
Snowflake
Read Table
Delete table
Create table from csv
Update table
Societe.com
Spotify
Streamlit
Stripe
Telegram
Thinkific
TikTok
Trello
Twilio
Twitter
WSR
WorldBank
Worldometer
XML
YahooFinance
YouTube
Youtube
ZIP
Zapier
spaCy
Google Analytics
Google Drive
Google Search
Google Sheets
Hugging Face
Johns Hopkins
Jupyter Notebooks
Metrics Store
Microsoft Teams
Microsoft Word
Naas Auth
Elastic Search
Excel 365
🔄
Low-code features
🏎
Low-code drivers
🌎
Community
Essentials
Advanced
Best Practices
FAQ
⚡
Naas manager
🔐
Security
Powered By
GitBook
Update table
Tags:
#snowflake #database #snippet
Author:
Sanjay Sabu
Input
Import libraries
1
import
csv
2
from
snowflakeconnector
import
SnowflakeConnector
Copied!
Insert your credentials
1
username
=
"sanjaynaas"
2
password
=
"Password123"
Copied!
Specify your account details
1
account
=
"iz84541.europe-west4.gcp"
2
database
=
"DEMO_DB"
3
table_name
=
"NAAS"
Copied!
Model
Read the csv file and converting to list
1
with
open
(
'Excel-Sales_Feb2020.csv'
)
as
f
:
2
reader
=
csv
.
reader
(
f
)
3
d_list
=
list
(
reader
)
4
d_list
Copied!
Connecting to Snowflake
1
#Initialize SnowflakeConnector
2
instance
=
SnowflakeConnector
(
username
,
password
,
account
,
database
)
Copied!
Updating Snowflake
1
for
i
in
range
(
1
,
len
(
d_list
)):
2
table_insert_csv_query
=
"INSERT INTO NAAS values"
3
table_insert_csv_query
=
table_insert_csv_query
+
str
(
tuple
(
d_list
[
i
]))
4
instance
.
execute_query
(
table_insert_csv_query
,
query_type
=
"push"
)
Copied!
Output
To see contents of table
1
table_display_query
=
"select * from "
+
table_name
2
#Fetch records from Snowflake database
3
instance
.
execute_query
(
table_display_query
,
query_type
=
"pull"
)
Copied!
Closing the Connection
1
instance
.
close_connection
()
Copied!
Display result
Previous
Create table from csv
Next
Societe.com
Last modified
2mo ago
Copy link
Edit on GitHub
Contents
Input
Model
Output