sql_cluster_execution¶
SQL_CLUSTER_EXECUTION
Generic Cluster Execution script for executing SQL across multiple clusters or nodes.
Parameters:
p_sql_stmt (
str) – The SQL statement to be executed across the cluster.p_propagate (
str) – Parameters for snapshot execution and propagation.p_emit_clause (
str) – The definition of the output columns (EMITS).
returns: emits – Returns a result set as defined in the
emit_clause.raises RequestException: In case of cluster communication or execution errors.
Examples¶
Snapshot execution across the cluster
1select * from (
2 import from script sql_cluster_execution with propagate=
3 '/*snapshot execution*/
4 select b.param_value as db_name,
5 CAST(interval_start AS DATE) - DATE ''''''''1970-01-01'''''''' AS t_days,
6 raw_object_size_avg
7 FROM exa_db_size_daily a
8 join exa_metadata b on b.param_name=''''''''databaseName''''''''',
9 emit_clause='DB_NAME varchar(30), T_DAYS decimal(18,0), RAW_OBJECT_SIZE_AVG decimal(10,1)'
10);