Schema resources
schema
SchemaProvider
Schema-scoped provider — safe to import inside a Snowpark stored procedure.
Deploys only objects that can exist within a client schema: tables, views, procedures, stages, secrets (client credentials), tasks, streams, and so on. Never creates account-level objects (warehouses, roles, EAIs).
Intended for use in PROVISION_CLIENT() running via EXECUTE AS OWNER
inside Snowflake. Import path kept lightweight for ARTIFACT_REPOSITORY.
Example
.. code-block:: python
# ARTIFACT_REPOSITORY_PACKAGES = ('pinky-provider[schema]')
from pinky_provider.resources.schema import SchemaProvider
def provision_client(session, team_id, product_db, client_id):
provider = SchemaProvider(session)
provider.apply(
source=f"{product_db}.PUBLIC.GIT_REPO:/manifest_client/",
target=f"{product_db}.{client_id}",
vars={"client_id": client_id},
)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session
|
Any
|
Active Snowpark |
required |
Source code in src/pinky_provider/resources/schema/__init__.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
apply(source, target, vars=None)
Apply the manifest to the target schema.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
|
required |
target
|
str
|
Target schema as |
required |
vars
|
dict[str, str] | None
|
Jinja2 variables injected into the manifest. |
None
|
Source code in src/pinky_provider/resources/schema/__init__.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
plan(source, target, vars=None)
Compute changes without applying them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
str
|
|
required |
target
|
str
|
Target schema as |
required |
vars
|
dict[str, str] | None
|
Jinja2 variables injected into the manifest. |
None
|
Returns:
| Type | Description |
|---|---|
list[Any]
|
Ordered list of :class: |
Source code in src/pinky_provider/resources/schema/__init__.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |