Skip to content

Commit a42c596

Browse files
titan-teejteej
andauthored
bugfix (#19)
* README and priv bugs * note * version bump --------- Co-authored-by: TJ Murphy <[email protected]>
1 parent c0c53a6 commit a42c596

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

images/github-explainer.png

-20.3 KB
Loading

scripts/install

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ RETURNS OBJECT NOT NULL
33
LANGUAGE PYTHON
44
RUNTIME_VERSION = '3.9'
55
PACKAGES = ('snowflake-snowpark-python', 'inflection', 'pyparsing')
6-
IMPORTS = ('@titan_aws/releases/titan-0.1.5.zip')
6+
IMPORTS = ('@titan_aws/releases/titan-0.1.6.zip')
77
HANDLER = 'titan.spi.install'
88
EXECUTE AS CALLER
99
CALL install()

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
setup(
44
name="titan",
5-
version="0.1.5",
5+
version="0.1.6",
66
description="Snowflake infrastructure as code",
77
long_description=open("README.md").read(),
88
long_description_content_type="text/markdown",

titan/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"Warehouse",
2121
]
2222

23-
__version__ = "0.1.5"
23+
__version__ = "0.1.6"
2424

2525
LOGO = r"""
2626
__ _ __

titan/blueprint.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,12 @@ def _contains(role, principal, priv):
226226
if role_grants:
227227
for principal, grant_list in role_grants.items():
228228
for grant in grant_list:
229-
priv = priv_for_principal(parse_URN(principal), grant["priv"])
230-
_add(role, principal, priv)
229+
try:
230+
priv = priv_for_principal(parse_URN(principal), grant["priv"])
231+
_add(role, principal, priv)
232+
except ValueError:
233+
# Priv not recognized by Titan
234+
pass
231235

232236
# Implied privilege grants in the context of our plan
233237
for action, urn_str, data in plan:
@@ -483,8 +487,6 @@ def generate_manifest(self, session_context: dict = {}):
483487

484488
urns.append(manifest_key)
485489

486-
print(urn, resource)
487-
488490
for ref in resource.refs:
489491
ref_urn = URN.from_resource(account_locator=self._account_locator, resource=ref)
490492
refs.append((str(urn), str(ref_urn)))
@@ -586,7 +588,6 @@ def destroy(self, session, manifest=None):
586588
try:
587589
execute(session, lifecycle.drop_resource(urn, data))
588590
except snowflake.connector.errors.ProgrammingError as err:
589-
print("failed")
590591
continue
591592

592593
def _add(self, resource: Resource):

titan/lifecycle.py

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def drop_future_grant(urn: URN, data: dict, **kwargs):
219219

220220

221221
def drop_grant(urn: URN, data: dict, **kwargs):
222+
# FIXME
222223
if data["priv"] == "OWNERSHIP":
223224
return "select 1"
224225
return tidy_sql(

titan/privs.py

+9
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ class AlertPriv(ParseableEnum):
110110

111111
class DatabasePriv(ParseableEnum):
112112
ALL = "ALL"
113+
APPLYBUDGET = "APPLYBUDGET"
113114
CREATE_DATABASE_ROLE = "CREATE DATABASE ROLE"
114115
CREATE_SCHEMA = "CREATE SCHEMA"
115116
IMPORTED_PRIVILEGES = "IMPORTED PRIVILEGES"
@@ -198,13 +199,18 @@ class RolePriv(ParseableEnum):
198199
class SchemaPriv(ParseableEnum):
199200
ALL = "ALL"
200201
ADD_SEARCH_OPTIMIZATION = "ADD SEARCH OPTIMIZATION"
202+
APPLYBUDGET = "APPLYBUDGET"
201203
CREATE_ALERT = "CREATE ALERT"
204+
CREATE_AUTHENTICATION_POLICY = "CREATE AUTHENTICATION POLICY"
202205
CREATE_DYNAMIC_TABLE = "CREATE DYNAMIC TABLE"
203206
CREATE_EXTERNAL_TABLE = "CREATE EXTERNAL TABLE"
204207
CREATE_FILE_FORMAT = "CREATE FILE FORMAT"
205208
CREATE_FUNCTION = "CREATE FUNCTION"
209+
CREATE_HYBRID_TABLE = "CREATE HYBRID TABLE"
210+
CREATE_ICEBERG_TABLE = "CREATE ICEBERG TABLE"
206211
CREATE_MASKING_POLICY = "CREATE MASKING POLICY"
207212
CREATE_MATERIALIZED_VIEW = "CREATE MATERIALIZED VIEW"
213+
CREATE_MODEL = "CREATE MODEL"
208214
CREATE_NETWORK_RULE = "CREATE NETWORK RULE"
209215
CREATE_PACKAGES_POLICY = "CREATE PACKAGES POLICY"
210216
CREATE_PASSWORD_POLICY = "CREATE PASSWORD POLICY"
@@ -218,6 +224,7 @@ class SchemaPriv(ParseableEnum):
218224
CREATE_SNOWFLAKE_ML_FORECAST = "CREATE SNOWFLAKE.ML.FORECAST"
219225
CREATE_STAGE = "CREATE STAGE"
220226
CREATE_STREAM = "CREATE STREAM"
227+
CREATE_STREAMLIT = "CREATE STREAMLIT"
221228
CREATE_TABLE = "CREATE TABLE"
222229
CREATE_TAG = "CREATE TAG"
223230
CREATE_TASK = "CREATE TASK"
@@ -256,6 +263,7 @@ class StreamPriv(ParseableEnum):
256263

257264
class TablePriv(ParseableEnum):
258265
ALL = "ALL"
266+
APPLYBUDGET = "APPLYBUDGET"
259267
DELETE = "DELETE"
260268
INSERT = "INSERT"
261269
OWNERSHIP = "OWNERSHIP"
@@ -294,6 +302,7 @@ class ViewPriv(ParseableEnum):
294302

295303
class WarehousePriv(ParseableEnum):
296304
ALL = "ALL"
305+
APPLYBUDGET = "APPLYBUDGET"
297306
MODIFY = "MODIFY"
298307
MONITOR = "MONITOR"
299308
OPERATE = "OPERATE"

0 commit comments

Comments
 (0)