1. Create Share
2. Grant privileges to share
3. Add consumer account(s)
4. Import share
CREATE DATABASE my_db FROM SHARE my_share;
CREATE SHARE my_share;
GRANT USAGE ON DATABASE my_db TO SHARE my_share;
GRANT USAGE ON SCHEMA my_schema.my_db TO SHARE my_share;
GRANT SELECT ON TABLE my_table.myschema.my_db TO SHARE my_share;
ALTER SHARE my_share ADD ACCOUNT a123bc;
CREATE DATABASE my_db FROM SHARE my_share;
To know the usage history,
SELECT * FROM information_schema.materialized_view_refresh_history();
SELECT * FROM information_schema.materialized_view_refresh_history(materialized_view_name => 'mname'));
SELECT * FROM snowflake.account_usage.materialized_view_refresh_history;
Resizing: Warehouses can be resized even when query is running or when suspended.
It impact only future queries, not the running one.
Scale Up vs Scale Out:
Scale Up (Resize) - More complex queries
Scale Out - More User (More queries)
In 3 ways we will ab able to view the query history,
1. Using SNOWSIGHT( Web UI)
2. Using INFORMATION_SCHEMA
SELECT * FROM TABLE (information_schema.query_history()) ORDER BY start_time;
3. Using ACCOUNT_USAGE
SELECT * FROM snowflake.account_usage.query_history;
Syntax:
COPY INTO @stage_name FROM (SELECT col1, col2, col3 FROM table_name)
FILE_FORMAT = (TYPE = CSV)
HEADER = TRUE
Additional Parameters:
SINGLE
Use the SINGLE parameter to specify whether the file will be split into multiple files. The default is set to FALSE which means the data will be split across multiple files
MAX_FILE_SIZE
To define the file size
| CopyOption | Description | Values |
|---|---|---|
| ON_ERROR | Specifies the error handling for the load operation | CONTINUE | SKIP_FILE | SKIP_FILE_num | 'SKIP_FILE_num%' | ABORT_STATEMENT |
| SIZE_LIMIT | Specifies the maximum size (in bytes) of data to be loaded | <num> |
| PURGE | Remove files after successful load | TRUE | FALSE |
| RETURN_FAILED_ONLY | Return only files that have failed to load | TRUE | FALSE |
| MATCH_BY_COLUMN_NAME | Load semi-structured data into columns in matching the columns names | CASE_SENSITIVE | CASE_INSENSITIVE | NONE |
| ENFORCE_LENGTH | Truncate text strings that exceed the target column length | TRUE | FALSE |
| TRUNCATECOLUMNS | Truncate text strings that exceed the target column length | TRUE | FALSE |
| FORCE | Load files even if loaded before | TRUE | FALSE |
| LOAD_UNCERTAIN_FILES | Load files even if load status unknown | TRUE | FALSE |
What is Kiro Kiro is an innovative AI-powered IDE that revolutionizes software development through intelligent assistance and structured wor...