ice_pick.schema_object#
Module Contents#
Classes#
Represents a Snowflake Schema object. |
- class ice_pick.schema_object.SchemaObject#
Represents a Snowflake Schema object.
Schema Objects Include: ALERTS, EXTERNAL FUNCTIONS, EXTERNAL TABLES, FILE FORMATS, MATERIALIZED VIEWS, MASKING POLICIES, PASSWORD POLICIES, PIPES, PROCEDURES, ROW ACCESS POLICIES, SECRETS, SESSION POLICIES, SEQUENCES, STAGES, STREAMS, TABLES, TAGS, TASKS, USER FUNCTIONS, VIEWS, *EXTERNAL FUNCTIONS,
PROCEDURES, *USER FUNCTIONS * Also note some of these objects require the enterprise account
- session#
Snowpark Session
- Type:
Session
- database#
database that the object is in
- Type:
str
- schema#
schema that the object is in
- Type:
str
- object_name#
the name of the object
- Type:
str
- object_type#
the type of schema object
- Type:
str
- session: snowflake.snowpark.Session#
- database: str = 'SNOWFLAKE'#
- schema: str = ''#
- object_name: str = ''#
- object_type: str = ''#
- get_ddl(save: bool = False, fully_qualified: bool = True) str#
Return the ddl of the schema object as a string if save = True: save the ddl locally The default save path is: DDL/database/schema/object_type/database.schema.object_name.sql
- Parameters:
save (bool = False) – save the ddl as a file locally
- Returns:
A string with the ddl
- Return type:
str
- get_description() str#
Return the description of the schema object as a string
- get_grants_on() list#
Return a list of grants on the schema object as a list
- get_grant_objects() list#
- grant(privilege: list, grantee: str) str#
grant access on object, return status
– For TABLE{ SELECT | INSERT | UPDATE | DELETE | TRUNCATE | REFERENCES } [ , … ]– For VIEW{ SELECT | REFERENCES } [ , … ]– For MATERIALIZED VIEW{ SELECT | REFERENCES } [ , … ]– For SEQUENCE, FUNCTION (UDF or external function), PROCEDURE, or FILE FORMATUSAGE– For internal STAGEREAD [ , WRITE ]– For external STAGEUSAGE– For PIPE{ MONITOR | OPERATE } [ , … ]– For STREAMSELECT– For TASK{ MONITOR | OPERATE } [ , … ]– For MASKING POLICYAPPLY– For PASSWORD POLICYAPPLY– For ROW ACCESS POLICYAPPLY– For SESSION POLICYAPPLY– For TAGAPPLY– For ALERTOPERATE– For SECRETUSAGE
- create(create_method: str = 'default', ddl: str = '', sql_ext: str = '', create_if_exists: bool = False)#
create in snowflake if not exists. For now this is very dependant on object type. Usualy the additional stuff comes after the object name, which can be provided by the sql_ext param. (todo: sql ext could just make more confusing - maybe need to create specific extension objects)
- create_methods:
default:
ddl: user provided ddl string
ddl_state: use ddl from get_ddl() function