ice_pick.filters#

Module Contents#

Classes#

SchemaObjectFilter

A filter that can be used to return multiple SchemaObjects

AccountObjectFilter

A filter that can be used to return multiple AccountObjects

PrivilegeFilter

GrantFilter

Functions#

ice_pick.filters._default_field(obj)#
class ice_pick.filters.SchemaObjectFilter#

A filter that can be used to return multiple SchemaObjects

Apply selection first, then filter out ingore objects.

Filters are applied by:

database -> ignore_dbs -> schema -> ignore_schemas -> object type -> object name

“.*” can be used to return all (regex supported)

session#

Snowpark Session

Type:

Session

databases#

databases that wil be searched

Type:

list

schemas#

schemas that wil be searched

Type:

list

object_names#

the name of the objects to be searched for

Type:

list

object_types#

the type of schema objects to be searched for

Type:

list

ignore_dbs#

databases to be ignored in search

Type:

list

ignore_schemas#

schemas to be ignored in search

Type:

list

session: snowflake.snowpark.Session#
databases: list#
schemas: list#
object_names: list#
object_types: list#
ignore_dbs: list#
ignore_schemas: list#
_filter_schema_objects_helper(objects_df: pandas.DataFrame, filtered_dbs: str, filtered_schemas: str, obj_type: str) pandas.DataFrame#

a helper function for filtering dataframe for objects

_filter_schema_objects(filtered_dbs: str, filtered_schemas: str) pandas.DataFrame#
helper function to get all schema level object info
  • get the object types that are selected

  • get the object info (database, schema, object type, object name)

  • The object info returned depends on the selected object types (see schema_level_exceptions)

return_schema_objects() List[ice_pick.schema_object.SchemaObject]#

Filter objects based on input objects If the property is a wildcard “.*”, then search all objects at that level (inputs are passed as regex)

If exclude is set to true, everything matched will be ignored, and all non-matches are returned

Parameters:

None

Returns:

a list of schema objects that matched the filter cases

Return type:

List[SchemaObjects]

Example

Get all procedures in all databases:
>> SchemaObjectFilter([“.*”], [“.*”], [“.*”], [“procedure”])
Get all tables and vies in a single database:
>> SchemaObjectFilter([“TEST_DB”], [“.*”], [“.*”], [“table”, “view”])
Get all tables except for the sample tables:
>> SchemaObjectFilter([“.*”], [“.*”],[“.*”], [“table”], ingore_dbs = [“SNOWFLAKE”, “SNOWFLAKE_SAMPLE_DATA”]
Get specific tables:
>> SchemaObjectFilter([“snowflake”], [“sample_data”], [“customer”, “transactions”], [“table”])
class ice_pick.filters.AccountObjectFilter#

A filter that can be used to return multiple AccountObjects

Apply selection first, then filter out ingore objects.

Filters are applied by:

object_types -> object_names -> ignore_names

“.*” can be used to return all (regex supported)

session#

Snowpark Session

Type:

Session

object_names#

objects that will be searched

Type:

list

object_types#

object types that will be searched

Type:

list

ignore_names#

names to be ignored in search

Type:

list

session: snowflake.snowpark.Session#
object_names: list#
object_types: list#
ignore_names: list#
_query_account_object_helper() Dict[str, pandas.DataFrame]#

get all avialable account objects based on type Return a dictionary of the object type and the assocated pandas dataframe (todo - compare vs just getting everything then filtering)

_filter_name_account_objects(account_object_collection: Dict[str, pandas.DataFrame]) Dict[str, pandas.DataFrame]#

Filter objects to only selected names

_filter_ignore_account_objects(account_object_collection: Dict[str, pandas.DataFrame]) Dict[str, pandas.DataFrame]#

Filter objects to remove “ignore” names

__create_account_object_instances(object_type: str, object_names: list) List[ice_pick.account_object.AccountObject]#

create a single account object helper for creating all account objects

_create_account_objects(account_object_collection: Dict[str, pandas.DataFrame]) List[ice_pick.account_object.AccountObject]#

create the objects frm the account object collection

return_account_objects() List[ice_pick.account_object.AccountObject]#

Return all account objects matching the filter

class ice_pick.filters.PrivilegeFilter#
session: snowflake.snowpark.Session#
class ice_pick.filters.GrantFilter#
session: snowflake.snowpark.Session#