This file contains 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 function connected_component(id1 varchar, id2 varchar) | |
returns table(identifier varchar, gr_members variant) | |
language python | |
runtime_version = '3.11' | |
packages = ('networkx') | |
handler = 'graph' | |
as | |
$$ | |
import networkx as nx |
This file contains 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 PROCEDURE EXECUTE_SCHEDULED(COMMAND VARCHAR, IN_NEXT_MINUTES INTEGER) RETURNS STRING | |
LANGUAGE SQL | |
AS | |
$$ | |
BEGIN | |
LET TASK_NAME VARCHAR := 'SCHEDULED_COMMAND_' || UUID_STRING(); | |
LET CREATE_TASK_COMMAND VARCHAR := 'CREATE TASK "' || :TASK_NAME || | |
'" SCHEDULE = \'' || :IN_NEXT_MINUTES || ' MINUTES\' USER_TASK_MANAGED_INITIAL_WAREHOUSE_SIZE = ''XSMALL'' AS ' || | |
' BEGIN \n' || | |
COMMAND || '; DROP TASK "' || :TASK_NAME || '"; \n' || |
This file contains 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
prompts: | |
- name: "DataFrameReader.load" | |
prompt: | | |
Explain this tag: | |
------ TAG | |
@@firstline | |
and how it affects the following line of code: | |
------ | |
**CODE** |
This file contains 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
from snowflake.core import Root | |
from snowflake.core._common import CreateMode | |
from snowflake.core.task import Cron | |
from snowflake.core.task.dagv1 import DAG, DAGTask, DAGOperation, DAGTaskBranch | |
from snowflake.snowpark import Session | |
from snowflake.core import Root | |
from snowflake.snowpark import Session | |
import yaml |
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 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 procedure proc_logged_to_stage(arg1 string, arg2 string) | |
returns string | |
language python | |
runtime_version = 3.11 | |
packages =('snowflake-snowpark-python') | |
handler = 'logged_main' | |
as | |
$$ | |
from snowflake.snowpark import Session | |
from snowflake.snowpark.functions import col |
This file contains 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
# Import python packages sqlparse snowflake-snowpark-python streamlit | |
# For this streamlit to work, I am assuming you have | |
# a database called JSON_GENIE_DB, and stage called JSON_GENIE_DB.PUBLIC.SAMPLES | |
# and a json file format called JSON_GENIE_DB.PUBLIC.JSON_GENIE_FILE_FORMAT. | |
# CREATE OR REPLACE FILE FORMAT JSON_GENIE_FILE_FORMAT | |
# TYPE = JSON | |
# NULL_IF = () | |
#; | |
# The only thing that you need is to upload some sample files into the JSON_GENIE_DB.PUBLIC.SAMPLES stage. |
This file contains 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 STORAGE INTEGRATION s3_json_ingestion_int | |
TYPE = EXTERNAL_STAGE | |
STORAGE_PROVIDER = 'S3' | |
ENABLED = TRUE | |
STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::00000000000:role/s3-json-ingestion-role' | |
STORAGE_ALLOWED_LOCATIONS = ('s3://s3-json-ingestion/customers'); | |
CREATE STAGE CUSTOMERS | |
URL = 's3://s3-json-ingestion/customers' | |
STORAGE_INTEGRATION = S3_JSON_INGESTION_INT |
This file contains 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
[ | |
{ | |
"customer_id": 3, | |
"name": "Alice Johnson", | |
"contact": { | |
"email": "alice@example.com", | |
"phone": "555-1234" | |
}, | |
"address": { | |
"street": "123 Elm Street", |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder