Titan-Systems/titan

AttributeError: module 'titan.data_provider' has no attribute 'list_future_grants'. Did you mean: 'list_role_grants'?

michael-lemiale opened this issue · 2 comments

Titan gets about halfway through the plan with show grants / databases etc. then throws this error

Python Version - 3.11
Titan Version - 0.9.1

Full Error

Traceback (most recent call last):
  File "/Users/michaellemiale/Projects/tf-snowflake/titan/main.py", line 1196, in <module>
    plan_and_apply(
  File "/Users/michaellemiale/Projects/tf-snowflake/titan/main.py", line 1186, in plan_and_apply
    plan = blueprint.plan(session)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/michaellemiale/.pyenv/versions/3.11.6/lib/python3.11/site-packages/titan/blueprint.py", line 781, in plan
    remote_state = self.fetch_remote_state(session, manifest)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/michaellemiale/.pyenv/versions/3.11.6/lib/python3.11/site-packages/titan/blueprint.py", line 537, in fetch_remote_state
    for fqn in data_provider.list_resource(session, resource_label_for_type(resource_type)):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/michaellemiale/.pyenv/versions/3.11.6/lib/python3.11/site-packages/titan/data_provider.py", line 2178, in list_resource
    return getattr(__this__, f"list_{pluralize(resource_label)}")(session)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'titan.data_provider' has no attribute 'list_future_grants'. Did you mean: 'list_role_grants'?

Code

# Connection
# Titan compares your config to a Snowflake account. Create a Snowflake
# connection to allow Titan to connect to your account.
connection_params = {
    "account": os.environ["SNOWFLAKE_ACCOUNT"],
    "user": os.environ["SNOWFLAKE_USER"],
    "password": os.environ["SNOWFLAKE_PASSWORD"],
    "role": "ACCOUNTADMIN",
}
session = snowflake.connector.connect(**connection_params)

# Blueprint
# Create a Blueprint and pass your resources into it. A Blueprint helps you
# validate and deploy a set of resources.
blueprint = Blueprint(
    resources=resources,
    run_mode=RunMode.SYNC,
    allowlist=[
        "DATABASE",
        "STORAGE INTEGRATION",
        "FUTURE GRANT",
        "GRANT",
        "ROLE",
        "ROLE GRANT",
        "STAGE",
        "USER",
        "WAREHOUSE",
    ],
)

# Plan
# Blueprint works like Terraform. Calling plan(...) will compare your config
# to the state of your Snowflake account and return a list of changes.
plan = blueprint.plan(session)
teej commented

Thanks for the report, I'll add this to an upcoming release.

teej commented

Fixed in v0.10