Real Estate JSON Quick Start

Pancake's application package includes REALESTATE_JSON, a sample data source designed to show you the scanning capabilities of the app.

Below is a script you can copy and paste into a new Worksheet after you have installed Pancake from the Snowflake Marketplace.

After following the instructions and running the script you will see the REALESTATE_JSON data source added to Pancake, and you will be able to view Schema Summary information, a sample of Schema Analysis information, and the Dynamic Tables the data sources flattens out into.

  • Script #1 will set up Pancake using our sample real estate data provided with the Pancake install which includes only two records.

  • Script #1A - will create a new database and schema in your Snowflake Account with Pancake dynamic tables to extract, flatten, and relate the real estate sample dataset. A sample select statement is also provided to show you how much better it is to process data using dynamic tables instead of parsing raw JSON.

/* ********** SCRIPT #1 - Sample Data (Real Estate)

Script Placeholders:

(For convenience, you can use the built in find/replace feature in Snowflake for the following placeholders)

<application_install_role> (x2) - Use the name of the role you used to install Pancake. 

In order to run this script you will also need to have access to the ACCOUNTADMIN role. 
After running the following SQL statements you can open Pancake and go to the Data Source Overview to see the new data source.

*/

USE ROLE <application_install_role>;
GRANT APPLICATION ROLE PANCAKE.APP_PUBLIC TO ROLE ACCOUNTADMIN;

USE ROLE ACCOUNTADMIN;

GRANT EXECUTE TASK ON ACCOUNT TO APPLICATION PANCAKE;

USE ROLE <application_install_role>;

CREATE OR REPLACE WAREHOUSE PANCAKE_X_SMALL_01 WITH
  WAREHOUSE_SIZE = 'X-Small';

GRANT USAGE on WAREHOUSE PANCAKE_X_SMALL_01 to APPLICATION PANCAKE;

DECLARE
    warehouse_name VARCHAR DEFAULT 'PANCAKE_X_SMALL_01';
    warehouse_size VARCHAR DEFAULT 'X-Small';
    call_result VARCHAR;
BEGIN
    CALL PANCAKE.CORE.ADD_WAREHOUSE(:warehouse_name, :warehouse_size) into :call_result;
    return call_result;
END;

DECLARE 
	datasource_name VARCHAR DEFAULT 'PANCAKE.SAMPLE_DATA.REALESTATE_JSON'; 
	object_type VARCHAR DEFAULT 'Table'; 
	database_name VARCHAR DEFAULT 'PANCAKE'; 
	schema_name VARCHAR DEFAULT 'SAMPLE_DATA'; 
	object_name VARCHAR DEFAULT 'REALESTATE_JSON'; 
	column_name VARCHAR DEFAULT 'JSON_DATA'; 
	datasource_tag VARCHAR DEFAULT ''; 
	warehouse_name VARCHAR DEFAULT 'PANCAKE_X_SMALL_01'; 
	record_limit DEFAULT 150; 
	initiate_scan DEFAULT TRUE; 
	call_result VARCHAR;
BEGIN 
	CALL PANCAKE.core.add_datasource_with_scan( 
:datasource_name,:object_type,:database_name,:schema_name,:object_name,:column_name, 
:warehouse_name, :record_limit, :initiate_scan, :datasource_tag) into
:call_result;

return call_result;

END;

Script #1A

Last updated

Was this helpful?