Guest User

Untitled

a guest
Oct 15th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. Exercise 1 – Prepare your data set
  2. 1. Connect to Redshift cluster XX and table YY. Set a refresh schedule on the dataset.
  3. Step 1: Go to Manage Data -> New data set -> Redshift (manual connect).
  4. Step 2: Enter the following to connect to a data source
  5. Data source name: QS 101 workshop <custom>
  6. Database server: redshift-cluster-1.cmtrp6jcotm9.us-east-1.redshift.amazonaws.com
  7. Port: 8192
  8. Database name: dev
  9. Username: awsuser
  10. Password: QSAnalytics123$
  11. Select this schema: sandbox
  12. Select this table: home_prices
  13.  
  14. Choose ‘Use custom SQL’
  15.  
  16. Step 3: Enter the following SQL. We will only need state, county name, regionname, timestamp and price for the analysis.
  17. Select state, countyname, regionname, sizerank, price, timestamp from sandbox.home_prices
  18. Choose ‘Import to SPICE for quicker analysis’ and hit ‘Edit/Preview data’
  19. Step 4: Edit data set schema
  20. On the top left, ensure the ‘Data source’ selected is SPICE. Make the following changes,
  21. • change the column name countyname to ‘county’ and data type from string to ‘County’
  22. • change the column name regionname to ‘city’ and data type to ‘City’
  23. • change the column name timestamp to ‘date’
  24. Step 5: Create a geospatial hierarchy
  25.  
  26. • Open the sub-menu from the ‘state’ field and select ‘Add to a hierarchy’.
  27. • Create a new geospatial hierarchy and call it ‘location’, choose ‘This hierarchy is for a single country’ and select ‘United States’.
  28. • Add state and city to the hierarchy.
  29. Step 6: Add a calculated field to extract the year from the date field (we will need this later)
  30. • Go to the fields tab on the left pane.
  31. • Select ‘New Field’ -> give a field name ‘year’ and enter formula toString(extract("YYYY",{date}))
  32. • Change the data type to string
Add Comment
Please, Sign In to add comment