Skip to content

Commit

Permalink
use the test schema prefix for uniqueness
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Oct 2, 2024
1 parent 3c8bdd6 commit 1052b2e
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/functional/auth_tests/test_database_role.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from random import randrange

import pytest

Expand Down Expand Up @@ -43,14 +42,13 @@ def project_config_update(self):
return {"models": {"+grants": {"select": [os.getenv("SNOWFLAKE_TEST_ROLE")]}}}

@pytest.fixture(scope="class", autouse=True)
def setup(self, project):
def setup(self, project, prefix):
"""
Create a database role with access to the model we're about to create.
The existence of this database role triggered the bug as dbt-snowflake attempts
to revoke it if the user also provides a grants config.
"""
unique_suffix = randrange(0, 1_000_000)
role = f"BLOCKING_DB_ROLE_{unique_suffix}"
role = f"BLOCKING_DB_ROLE_{prefix}"
project.run_sql(f"CREATE DATABASE ROLE {role}")
sql = f"""
GRANT
Expand Down

0 comments on commit 1052b2e

Please sign in to comment.