SNOW-SQL in SNOWFLAKE

SNOW-SQL in SNOWFLAKE

Published: None

Source: https://www.linkedin.com/pulse/snow-sql-snowflake-arabinda-mohapatra-wax1c?trackingId=ux5WBiGsSi2CFJi4kUVf3A%3D%3D


SNOW-SQL in SNOWFLAKE

Running Kafka streams after dark, diving into genetic code by daylight, and wrestling with Databricks and Tableflow in every spare moment—sleep is optional

SnowSQL is a command-line tool designed by Snowflake to interact with Snowflake databases. It allows users to execute SQL queries, perform data loading and unloading, and manage database objects

What will it covered

  • How can we upload files if a folder has space? How can we check/query stage data?
  • How can I upload only selected files? How to load files from Snowflake to a local stage?
  • How can I copy files from one stage to another stage? How to load files in stages?
  • How can I remove files from stages?
  • PUT & GET command (SNOWSQL) through CLI. How can we check all files from stages?
  • Can we apply any transformation on stage data?

Advantages:

  • Scalability: Easily scale compute resources to handle large data volumes.
  • Multi-cloud Support: Operate across different cloud providers.
  • Simplified Management: Streamline data analysis with a user-friendly interface.
  • Performance: Optimize queries with Snowflake's architecture.
  • Security: Robust features like access management and encryption.
  • Ease of Use: SQL familiarity reduces learning curve.

Challenges:

  • Cost: Pay-per-use model may lead to higher expenses.
  • Learning Curve: Understanding Snowflake’s architecture requires effort.
  • Performance: Complex queries might cause bottlenecks.
  • Migration: Moving large data volumes needs planning.


--Warehouse created

CREATE OR REPLACE WAREHOUSE LRN

Article content
WARE HOUSE CREATED

---Create database

CREATE OR REPLACE DATABASE LRN_DB


Article content
DATABASE CREATED



Article content
SCHEMA CREATED
Article content
SPECIFY WAREHOUSE,DATABASE,SCHEMA TO USE


Article content
FILE FORMAT WITH CSV


Article content
STAGE

  • Loading the data from local to stage

Article content
PUT COMMAND TO Load local to stage

  • Checking the stages

Article content
List of the files under Satge

  • Suppose the file which was already uploaded to stage- Later same file got modified & you want to reload it -will only load the added or modified data to stages

Article content
PUT DATA TO STAGE WITH OVERWRITE

  • In case we want to upload all the csv files that are stored in that folder to the stages

Article content

  • Check the data from a particular files that are uploaded to the stages

Article content
Qurey from Stage

  • Remove a particular file from the stage


Article content
Remove the file from stage

  • Check the files under the satges


Article content

  • Now we will copy the data from one stage to another stage
  • Create a stage by default will be file format as CSV


Article content

  • Now we will copy all the files from STAGE_CSV to OD01_STAGE

Article content

  • Check the files that are copied to OD01_STAGE;

Article content

  • Remove all the files from the stages;

Article content

  • Copy all the sample data to OD01_STAGE

Article content

  • Download the files from Stage to local directory

Article content

  • Apply different types of transformation of data on the top of staged files

Article content

Declartion: The views and opinions expressed in this presentation are those of the author and do not necessarily reflect the official policy or position of Novartis or any of its affiliates or officers

Reference:

https://docs.snowflake.com/

https://www.youtube.com/watch?v=DuowRboOWAI&list=PL__gObEGy1Y7klsW7vc2TM2Cmt6BwRkzh&index=13


Comments