titan
titan copied to clipboard
KeyError: 'view' when calling bp.plan() with FutureGrant using on_future_views_in
When I call bp.plan() after adding a future grant for all tables (or views, this applies to both) in a schema, titan raises a KeyError exception.
My FutureGrant:
grant = FutureGrant(priv="SELECT", on_future_views_in=Schema(name="SOME_DB.MY_SCHEMA"), to="MY_ROLE")
resources.append(grant)
The exception:
│ /home/vscode/.cache/pypoetry/virtualenvs/full/lib/python3.11/site-packages/titan/resources/resou │
│ rce.py:124 in get_metadata │
│ │
│ 121 │ │
│ 122 │ @classmethod │
│ 123 │ def get_metadata(cls, field_name: str): │
│ ❱ 124 │ │ return {f.name: f.metadata for f in fields(cls)}[field_name] │
│ 125 │
│ 126 │
│ 127 RESOURCE_SCOPES = { │
│ │
│ ╭───────────────────────── locals ──────────────────────────╮ │
│ │ cls = <class 'titan.resources.grant._FutureGrant'> │ │
│ │ field_name = 'view' │ │
│ ╰───────────────────────────────────────────────────────────╯
If necessary, I could put together a minimal example program showcasing the problem.