Update query without a condition but need to update a certain percentage of rows in the table for a specific column. Say I have 100 rows in a table, I want update a specific column based but no specific condition; just that 90% of the records in the table has to have this new value that I want to update.
Tag: snowflake-cloud-data-platform
How to separate a value taken from a table row and store it in an array in a snowflake
I need to return an array in the stored procedure that takes a comma separated string value from a table and divides that string based on the comma and stores them in an array. Example: My table has a Column Tab_Val with row value as “COL1,COL2,COL3,COL4”, I need to take this row in my stored procedure and return an array
Expanding Date Ranges
I want to expand the date ranges in the below “Original Table”. The end result should be the “Resultant Table”. I know that this can be done in sql using dateadd and ctes. However, …
Snowflake Json array/square brackets around all objects
I’m transforming Data in a JSON by using that code and get a result, that is pretty okay. But I need it in another format, so that our agency is able to use the data. This is the Code I use: The Result I get is every row as a JSON with squared brackets, which makes absolutely sense: But what
how to Join array with string in Snowflake
I have two tables: Books with column tag_ids (Array) Tags with column tag_id (Varchar) I have a visualisation tool that need to join these tables together. The only thing that I can control over is the join condition. the problem is that I can’t find a way to make this join work. this is what I tried: This works only
Create recursive query in Snowflake with a Left Join condition?
I am trying to create a recursive query that relies on a LEFT JOIN condition, but I am not sure if it is possible, especially in Snowflake. I have three tables: ITEM, ITEMHIERARCHY, and ITEMVALUE My goal is to return a list of all ITEMs with values and sub-item values rolled-up: Note that even though Item6 is a roll-up from
Creating thread safe MyBatis sessions from a java.sql.Connection
I’m trying to use MyBatis with a Snowflake database. My situation is similar to that of this poster: Configure mybatis to use an existing connection Essentially, I can get a java.sql.Connection Object, but I cannot get that by way of a DataSource, or other steps normally done by RDBMS databases like Oracle. One proposed solution is to do something like
snowflake substring by pattern
I have a string column in my table as below: i need a dynamic way of only extracting 123456 from these string. Can you plz suggest a solution. Answer Use the REGEXP_SUBSTR(…) built-in function to extract substrings using a regular expression pattern. If there will only be one number in each column value, a number pattern or a numeric characters
OR clause takes longer time
I have a query as an example below, but its running forever .. If I do union then I have copy entire large query .. Any help on this fix Answer The inner part can be written using the QUALIFY clause like so: which can be pushed into a CTE like: which means you can union that whole thing or
I am trying to access the data stored in a snowflake table using python sql. Below is the columns given below i want to access
Below is the data-sample and i want to access columns value,start. This data i dumped in one column(DN) of a table (stg) ##consider many lines stored in same column in different rows. Below query only fetched data for name. I want to access other columns value also. This query is a part of python script. Do i need to iterate