Questions tagged [snowsql]

SnowSQL is a command line tool for connecting to the Snowflake analytic data warehouse which is a Software-as-a-Service (SaaS) product.

SnowSQL is the next-generation command line client for connecting to Snowflake to execute SQL queries and perform all DDL and DML operations, including loading data into and unloading data out of database tables.

Snowflake is an analytic data warehouse provided as Software-as-a-Service (SaaS). Snowflake provides a data warehouse that is faster, easier to use, and far more flexible than traditional data warehouse offerings.

Link to documentation and more information

110 questions
2
votes
3 answers

is there a way to put comments in SnowSQL files that do not cause errors?

I'm using files with snowsql to automate certain processes. For maintenance, I want to include comments in the file (using // at the start of the line) to explain key steps. However, when I do this snowsql reports an error: 000900 (42601): SQL…
BrianHobbs
  • 127
  • 1
  • 10
2
votes
2 answers

Invalid regular expression error in snowflake

I'm trying to extract date (20200222) from filename while copyinto command in snowflake. File Name s3://hadoop/2020002/dbo.DOSSIER_TRANSPORT_20200222.csv.gz snowflake query SELECT regexp_substr(metadata$filename, '/(_((\-|\+)?[0-9]+(\.[0-9]+)?).)/'…
marjun
  • 696
  • 5
  • 17
  • 30
2
votes
2 answers

Not able to connect to Snowflake database with snowsql

I am not able to connect with snowsql by Windows console: C:\Users\musik>snowsql -a [myAccount] -u [myUserName]
Installing version: 1.2.0 [####################################] 100%
2
votes
3 answers

Applying sliding window function with the help of a date field

I am trying count distinct id's within a day which is straight forward but how to count them for 7 day's back from the current date in the window, 30 day's back in the current window. I am sliding back for 7/30 rows from the current row but I think…
2
votes
1 answer

Snowsql two digit century start date cast issue

I want a result 2000-02-05 with below query in snowsql. alter session set TWO_DIGIT_CENTURY_START=2000; select cast ('05-FEB-00' as date) from dual; But I am getting 0001-02-05. I am using existing script to load date in snowflake which works for…
Dinesh Subedi
  • 2,603
  • 1
  • 26
  • 36
1
vote
1 answer

PDF generator functionality/utility in snowflake

currently we are using SQR to generate the PDF report in Exadata. We are planning to migrate from Exadata to Snowflake but wanted to know if there are any utilities similar to SQR or any other features to generate PDF report using snowflake? I would…
be happy
  • 11
  • 1
1
vote
1 answer

Assign snowsql select query output to an unix variable

how do we assign SNOWSQL select query output to an unix variable, i am using below shellscript and trying to assign the output of select statement to variable var2. but somehow it is not working. #!/bin/ksh set var2=(snowsql -c newConnection -o…
BalajiAWS
  • 137
  • 1
  • 12
1
vote
1 answer

Joining to perform a comparison match with possible swapped data

I'm trying to do a comparison match in snowflake between the first_name, middle_name, and last_name from a target table (700K rows) and from source table (1.5M rows). The values in the first_name, middle_name, and last_name can be partially, or…
Lukasz
  • 2,476
  • 10
  • 41
  • 51
1
vote
2 answers

Snowflake IF ELSE Stored Procedure logic

I have a tsql code that I'm tryinng to migrate into stored proc on Snowflake. I have a version 1 of the proc built and in production. BUT now have to do a lookup change based on IF-ELSE Logic. I can easily do it as suggested on T-sql but how do I…
1
vote
1 answer

Error while loading csv file to Snowflake Table as "Timestamp '9/15/2020 1:28:00 AM' is not recognized"

csv_file: |column_1 | Column_2 | Column_3 | |===========================================| |abc | xyz | 9/15/2020 1:28:00 AM | I am trying to load a file from s3 to snowflake using following command: COPY INTO table_name FROM…
1
vote
2 answers

How to convert array object in snowflake

I would like to convert the below array of objects into another form (varname is ignored as its not required, key and value is used to generate the output form). Any leads would be appreciated Input array: [ { "key": "string_U6", "value":…
1
vote
1 answer

Snowflake SQL Range between interval

I have input table with following structure - ID,Date, Value. I am trying to calculate minimum value in last 10 months for every record in dataset. For that I am using range between interval. The code below is working fine in SPARK SQL but for some…
user11885406
1
vote
5 answers

Execute Multiple SQL Insert Statements in parallel in Snowflake

I have a question about how it works when several SQL statements are executed in parallel in Snowflake. For example, if I execute 10 insert statements on 10 different tables with the same base table - will the tables be loaded in parallel?
Maiwand
  • 127
  • 1
  • 14
1
vote
1 answer

Bucketing Data, If Bucket Size Greater Then 1 Set Value To 1 Else 0

I'm using snowflake to attempt to bucket rows based on two columns and if that bucket size is greater then 1 then I need the value of of some new column to be 1, otherwise I would set it to 0. It's similar to NTILE() except that I would need this to…
Lukasz
  • 2,476
  • 10
  • 41
  • 51
1
vote
1 answer

Regular Expression not working as expected in Snoflake python connector

I have written a query which will filter out all the phone_no that is not of pattern (nnn)-nnn-nnnnn. select * from employee where not RLIKE(phone_no,'^\\(\\d{3}\\)-\\d{3}-\\d{4}$'); It is giving the result as expected when I am query directly in…
Atif
  • 1,012
  • 1
  • 9
  • 23