Policies
Import, sync, and inspect access-control policies on an external catalog. See Catalog ACL Policy Commands for what each command does.
import_policies, sync_policies, grant_policies, and revoke_policies take their change list through changes_path: the URL of a JSON file in your cloud-storage bucket. The usual flow is show_policies(..., diff="IMPORT") (or "SYNC"), then pass the returned URL as changes_path.
Methods
| Method | Description |
|---|---|
show_policies | Show the policies on a catalog, or the diff an import or sync would apply |
import_policies | Pull policies from the catalog into Onehouse |
sync_policies | Push Onehouse policies out to the catalog |
grant_policies | Grant the privileges listed in a change file |
revoke_policies | Revoke the privileges listed in a change file |
reset_policies | Clear every imported policy for the project |
show_policies
show_policies(
catalog: str,
*,
diff: str | None = None,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
| Parameter | Required | Type / values |
|---|---|---|
catalog | yes | str |
diff | no | "IMPORT", "SYNC" — show what that operation would change instead of the current policies |
Example
result = client.show_policies("unity_prod")
# Diff for an import
diff = client.show_policies("unity_prod", diff="IMPORT")
import_policies
import_policies(
catalog: str,
*,
changes_path: str,
unsafe_raw: bool = False,
timeout: float | None = None,
poll_interval: float | None = None,
)
| Parameter | Required | Type / values |
|---|---|---|
catalog | yes | str |
changes_path | yes | str — URL of the JSON change list |
Example
client.import_policies(
"unity_prod",
changes_path="s3://my-bucket/onehouse/query-results/diff-001.json",
)
sync_policies
Same signature as import_policies.
Example
client.sync_policies(
"unity_prod",
changes_path="s3://my-bucket/onehouse/query-results/diff-002.json",
)
grant_policies
Same signature as import_policies.
Example
client.grant_policies("unity_prod", changes_path="s3://my-bucket/acl/grants.json")
revoke_policies
Same signature as import_policies.
Example
client.revoke_policies("unity_prod", changes_path="s3://my-bucket/acl/revokes.json")
reset_policies
reset_policies(*, timeout=None, poll_interval=None)
Clears every policy Onehouse holds for the project, across all catalogs. It takes no catalog and does not change the external catalogs. There is no confirmation step.
Example
client.reset_policies()