This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE STREAM db_dev.revenue.od_forecast_booking_stream | |
ON TABLE db_dev.revenue.od_forecast_booking | |
APPEND_ONLY = TRUE; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH wlh as ( | |
SELECT DATE_TRUNC('hour', wl.start_time) start_time_trunced_at_hour, HOUR(wl.start_time) start_time_hour, | |
AVG(avg_running) avg_running, AVG(avg_queued_load) avg_queued_load, | |
AVG(avg_queued_provisioning) avg_queued_provisioning, AVG(avg_blocked) avg_blocked | |
FROM snowflake.account_usage.warehouse_load_history wl | |
WHERE DATE_TRUNC('DAY', wl.start_time) = '2020-03-26' | |
AND wl.warehouse_name = 'PUT_YOUR_WAREHOUSE_NAME' | |
GROUP BY start_time_trunced_at_hour, start_time_hour | |
ORDER BY start_time_trunced_at_hour asc | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH wlh | |
AS (SELECT DATE_TRUNC('hour', wl.start_time) start_time_trunced_at_hour, | |
HOUR(wl.start_time) start_time_hour, | |
AVG(avg_running) avg_running, | |
AVG(avg_queued_load) avg_queued_load, | |
AVG(avg_queued_provisioning) avg_queued_provisioning, | |
AVG(avg_blocked) avg_blocked | |
FROM snowflake.account_usage.warehouse_load_history wl | |
WHERE DATE_TRUNC('day', wl.start_time) = '2020-03-26' | |
AND wl.warehouse_name = 'PUT_YOUR_WAREHOUSE_NAME' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DATE_TRUNC('hour', start_time) start_time_trunced_at_hour, | |
HOUR(start_time) start_time_hour, | |
MINUTE(start_time) start_time_min, | |
AVG(avg_running) avg_running, | |
AVG(avg_queued_load) avg_queued_load, | |
AVG(avg_queued_provisioning) avg_queued_provisioning, | |
AVG(avg_blocked) avg_blocked | |
FROM snowflake.account_usage.warehouse_load_history | |
WHERE DATE_TRUNC('day', start_time) = '2020-03-26' | |
AND warehouse_name = 'PUT_YOUR_WAREHOUSE_NAME' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ALTER WAREHOUSE put_your_warehouse_name SET max_cluster_count = 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DATE_TRUNC('hour', start_time) start_time_trunced_at_hour, | |
HOUR(start_time) start_time_hour, | |
AVG(avg_running) avg_running, | |
AVG(avg_queued_load) avg_queued_load, | |
AVG(avg_queued_provisioning) avg_queued_provisioning, | |
AVG(avg_blocked) avg_blocked | |
FROM snowflake.account_usage.warehouse_load_history | |
WHERE DATE_TRUNC('DAY', start_time) = '2020-03-17' | |
AND warehouse_name = 'PUT_YOUR_WAREHOUSE_NAME' | |
GROUP BY start_time_trunced_at_hour, start_time_hour |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vvgsrk.data | |
import org.apache.spark.sql.SparkSession | |
import net.snowflake.spark.snowflake.Utils.SNOWFLAKE_SOURCE_NAME | |
/** This object test "snowflake on AWS" connection using spark | |
* from Eclipse, Windows PC. | |
* | |
* It uses Hadoop 2.7, Spark 2.3.2 | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Invoke Spark Shell | |
$ gluepyspark -v --properties-file /home/glue/glue_spark_shell.properties --packages com.databricks:spark-avro_2.11:4.0.0 | |
# Import required classes | |
import sys | |
from awsglue.transforms import * | |
from awsglue.utils import getResolvedOptions | |
from pyspark.context import SparkContext | |
from awsglue.context import GlueContext | |
from awsglue.dynamicframe import DynamicFrame, DynamicFrameReader, DynamicFrameWriter, DynamicFrameCollection |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Invoke Spark Shell | |
$ glue-spark-shell -v --properties-file /home/glue/glue_spark_shell.properties --packages com.databricks:spark-avro_2.11:4.0.0 | |
// Import Required Classes | |
import org.apache.spark.SparkContext | |
import com.amazonaws.services.glue.GlueContext | |
import com.amazonaws.services.glue.DynamicFrame | |
import com.amazonaws.services.glue.DynamicRecord | |
import com.amazonaws.services.glue.MappingSpec | |
import com.amazonaws.services.glue.errors.CallSite |