Skip to content

Commit 4301c4d

Browse files
committed
refactor: rename grant_config to grants_config for consistency
1 parent d1639da commit 4301c4d

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

sqlmesh/core/engine_adapter/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3133,14 +3133,14 @@ def _get_current_grants_config(self, table: exp.Table) -> GrantsConfig:
31333133
def _apply_grants_config_expr(
31343134
self,
31353135
table: exp.Table,
3136-
grant_config: GrantsConfig,
3136+
grants_config: GrantsConfig,
31373137
table_type: DataObjectType = DataObjectType.TABLE,
31383138
) -> t.List[exp.Expression]:
31393139
"""Returns SQLGlot Grant expressions to apply grants to a table.
31403140
31413141
Args:
31423142
table: The table/view to grant permissions on.
3143-
grant_config: Dictionary mapping permissions to lists of grantees.
3143+
grants_config: Dictionary mapping permissions to lists of grantees.
31443144
table_type: The type of database object (TABLE, VIEW, MATERIALIZED_VIEW).
31453145
31463146
Returns:
@@ -3156,14 +3156,14 @@ def _apply_grants_config_expr(
31563156
def _revoke_grants_config_expr(
31573157
self,
31583158
table: exp.Table,
3159-
grant_config: GrantsConfig,
3159+
grants_config: GrantsConfig,
31603160
table_type: DataObjectType = DataObjectType.TABLE,
31613161
) -> t.List[exp.Expression]:
31623162
"""Returns SQLGlot expressions to revoke grants from a table.
31633163
31643164
Args:
31653165
table: The table/view to revoke permissions from.
3166-
grant_config: Dictionary mapping permissions to lists of grantees.
3166+
grants_config: Dictionary mapping permissions to lists of grantees.
31673167
table_type: The type of database object (TABLE, VIEW, MATERIALIZED_VIEW).
31683168
31693169
Returns:

sqlmesh/core/engine_adapter/bigquery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,11 +1385,11 @@ def _dcl_grants_config_expr(
13851385
self,
13861386
dcl_cmd: t.Type[DCL],
13871387
table: exp.Table,
1388-
grant_config: GrantsConfig,
1388+
grants_config: GrantsConfig,
13891389
table_type: DataObjectType = DataObjectType.TABLE,
13901390
) -> t.List[exp.Expression]:
13911391
expressions: t.List[exp.Expression] = []
1392-
if not grant_config:
1392+
if not grants_config:
13931393
return expressions
13941394

13951395
# https://cloud.google.com/bigquery/docs/reference/standard-sql/data-control-language
@@ -1411,7 +1411,7 @@ def normalize_principal(p: str) -> str:
14111411
return f"{label}:{principal.lower()}"
14121412

14131413
object_kind = self._grant_object_kind(table_type)
1414-
for privilege, principals in grant_config.items():
1414+
for privilege, principals in grants_config.items():
14151415
if not principals:
14161416
continue
14171417

sqlmesh/core/engine_adapter/mixins.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,15 @@ def _dcl_grants_config_expr(
576576
self,
577577
dcl_cmd: t.Type[DCL],
578578
table: exp.Table,
579-
grant_config: GrantsConfig,
579+
grants_config: GrantsConfig,
580580
table_type: DataObjectType = DataObjectType.TABLE,
581581
) -> t.List[exp.Expression]:
582582
expressions: t.List[exp.Expression] = []
583-
if not grant_config:
583+
if not grants_config:
584584
return expressions
585585

586586
object_kind = self._grant_object_kind(table_type)
587-
for privilege, principals in grant_config.items():
587+
for privilege, principals in grants_config.items():
588588
args: t.Dict[str, t.Any] = {
589589
"privileges": [exp.GrantPrivilege(this=exp.Var(this=privilege))],
590590
"securable": table.copy(),
@@ -615,18 +615,18 @@ def _dcl_grants_config_expr(
615615
def _apply_grants_config_expr(
616616
self,
617617
table: exp.Table,
618-
grant_config: GrantsConfig,
618+
grants_config: GrantsConfig,
619619
table_type: DataObjectType = DataObjectType.TABLE,
620620
) -> t.List[exp.Expression]:
621-
return self._dcl_grants_config_expr(exp.Grant, table, grant_config, table_type)
621+
return self._dcl_grants_config_expr(exp.Grant, table, grants_config, table_type)
622622

623623
def _revoke_grants_config_expr(
624624
self,
625625
table: exp.Table,
626-
grant_config: GrantsConfig,
626+
grants_config: GrantsConfig,
627627
table_type: DataObjectType = DataObjectType.TABLE,
628628
) -> t.List[exp.Expression]:
629-
return self._dcl_grants_config_expr(exp.Revoke, table, grant_config, table_type)
629+
return self._dcl_grants_config_expr(exp.Revoke, table, grants_config, table_type)
630630

631631
def _get_grant_expression(self, table: exp.Table) -> exp.Expression:
632632
schema_identifier = table.args.get("db") or normalize_identifiers(

sqlmesh/core/engine_adapter/postgres.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,17 @@ def server_version(self) -> t.Tuple[int, int]:
146146
def _apply_grants_config_expr(
147147
self,
148148
table: exp.Table,
149-
grant_config: GrantsConfig,
149+
grants_config: GrantsConfig,
150150
table_type: DataObjectType = DataObjectType.TABLE,
151151
) -> t.List[exp.Expression]:
152152
# https://www.postgresql.org/docs/current/sql-grant.html
153-
return self._dcl_grants_config_expr(exp.Grant, table, grant_config)
153+
return self._dcl_grants_config_expr(exp.Grant, table, grants_config)
154154

155155
def _revoke_grants_config_expr(
156156
self,
157157
table: exp.Table,
158-
grant_config: GrantsConfig,
158+
grants_config: GrantsConfig,
159159
table_type: DataObjectType = DataObjectType.TABLE,
160160
) -> t.List[exp.Expression]:
161161
# https://www.postgresql.org/docs/current/sql-revoke.html
162-
return self._dcl_grants_config_expr(exp.Revoke, table, grant_config)
162+
return self._dcl_grants_config_expr(exp.Revoke, table, grants_config)

0 commit comments

Comments
 (0)