Skip to content
Advertisement

Tag: amazon-redshift

Want to run a query multiple times using a for loop and add each result into a dictionary. This code only execute once even as it loops through

I have a query that take a random sample of records. I want to do this multiple times and add each result into a dictionary, which I will concat into a pandas DataFrame later. This code only execute once even as it loops through. Answer cursor.fetchall() doesn’t execute the query, it just fetches the remaining results from the query that

Redshift : Coalesce Can’t Work As Expected

We’re complementing null value to all zero value like ’00’ on Redshift. Sometimes, I found coalesce function can’t work as we expected. If we use case and len, it can work fine as follows; So far, I have no idea why coalesce can’t work. Any advice would be appreciated. Thank you. Answer There is a difference between ” and NULL

Advertisement