Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rpalloni committed Sep 23, 2022
1 parent 0a20b09 commit a5b7f29
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
18 changes: 12 additions & 6 deletions dwh/redshift/querytkdb.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ FROM (
SELECT buyerid, sum(qtysold) total_quantity
FROM sales
GROUP BY buyerid
ORDER BY total_quantity desc limit 10) Q,
users
ORDER BY total_quantity desc limit 10) Q, users
WHERE Q.buyerid = userid
ORDER BY Q.total_quantity desc;

Expand All @@ -33,12 +32,12 @@ create table ext_file_upload.sales(
commission decimal(8,2),
saletime timestamp);

--load data from external file in s3
COPY ext_file_upload.sales from 's3://abc123/sales_tab.txt'
--load data in redshift from external file in s3
COPY ext_file_upload.sales FROM 's3://abc123/sales_tab.txt' -- n files 's3://abc123/sales_'
credentials 'aws_iam_role=arn:aws:iam::1234567891012:role/RedshiftS3Access' -- map the role to the cluster permissions
region '<region>'
delimiter '\t'
timeformat 'MM/DD/YYYY HH:MI:SS'
region '<region>';
timeformat 'MM/DD/YYYY HH:MI:SS';


--validation query: get total count of sales records
Expand All @@ -49,3 +48,10 @@ SELECT sum(qtysold)
FROM ext_file_upload.sales s, date
WHERE s.dateid = date.dateid
AND caldate = '2008-01-05';


-- unload data from redshift to s3 folder
UNLOAD ('select * from sales') TO 's3://abc123/unload/sales_'
iam_role 'arn:aws:iam::1234567891012:role/test-redshift-role-s3';


1 change: 0 additions & 1 deletion dwh/snowflake/snowpark_ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from snowflake.snowpark import Session
from snowflake.snowpark.functions import col, udf, sproc, call_udf
from snowflake.snowpark.types import StructType, StructField, DecimalType, StringType
from snowflake.snowpark.types import PandasDataFrame, PandasSeries

import pandas as pd
Expand Down

0 comments on commit a5b7f29

Please sign in to comment.