Skip to content

Commit

Permalink
fix: proper indentation for verify_permissions()
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan-Kim2028 committed Nov 22, 2024
1 parent 4350b93 commit 6e3f937
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions pipeline/materialized_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,21 +433,20 @@ def autocommit(self):
self.conn.commit()
self.conn.autocommit = original_autocommit

def verify_permissions(self) -> bool:
try:
with self.conn.cursor() as cur:
# Check schema creation permission
cur.execute("CREATE SCHEMA IF NOT EXISTS api;")

def verify_permissions(self) -> bool:
try:
with self.conn.cursor() as cur:
# Check schema creation permission
cur.execute("CREATE SCHEMA IF NOT EXISTS api;")

# Test materialized view creation permission
cur.execute("""
CREATE MATERIALIZED VIEW IF NOT EXISTS api.test_permissions
AS SELECT 1 AS col WITH NO DATA
""")
cur.execute(
"DROP MATERIALIZED VIEW IF EXISTS api.test_permissions")
return True
except Exception as e:
logger.error(f"Insufficient permissions: {e}")
return False
# Test materialized view creation permission
cur.execute("""
CREATE MATERIALIZED VIEW IF NOT EXISTS api.test_permissions
AS SELECT 1 AS col WITH NO DATA
""")
cur.execute(
"DROP MATERIALIZED VIEW IF EXISTS api.test_permissions")
return True
except Exception as e:
logger.error(f"Insufficient permissions: {e}")
return False

0 comments on commit 6e3f937

Please sign in to comment.