Skip to content

Commit fbc12da

Browse files
committed
refactor: rename grant_config to grants_config for consistency
1 parent 0446873 commit fbc12da

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

sqlmesh/core/engine_adapter/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,14 +3035,14 @@ def _get_current_grants_config(self, table: exp.Table) -> GrantsConfig:
30353035
def _apply_grants_config_expr(
30363036
self,
30373037
table: exp.Table,
3038-
grant_config: GrantsConfig,
3038+
grants_config: GrantsConfig,
30393039
table_type: DataObjectType = DataObjectType.TABLE,
30403040
) -> t.List[exp.Expression]:
30413041
"""Returns SQLGlot Grant expressions to apply grants to a table.
30423042
30433043
Args:
30443044
table: The table/view to grant permissions on.
3045-
grant_config: Dictionary mapping permissions to lists of grantees.
3045+
grants_config: Dictionary mapping permissions to lists of grantees.
30463046
table_type: The type of database object (TABLE, VIEW, MATERIALIZED_VIEW).
30473047
30483048
Returns:
@@ -3058,14 +3058,14 @@ def _apply_grants_config_expr(
30583058
def _revoke_grants_config_expr(
30593059
self,
30603060
table: exp.Table,
3061-
grant_config: GrantsConfig,
3061+
grants_config: GrantsConfig,
30623062
table_type: DataObjectType = DataObjectType.TABLE,
30633063
) -> t.List[exp.Expression]:
30643064
"""Returns SQLGlot expressions to revoke grants from a table.
30653065
30663066
Args:
30673067
table: The table/view to revoke permissions from.
3068-
grant_config: Dictionary mapping permissions to lists of grantees.
3068+
grants_config: Dictionary mapping permissions to lists of grantees.
30693069
table_type: The type of database object (TABLE, VIEW, MATERIALIZED_VIEW).
30703070
30713071
Returns:

sqlmesh/core/engine_adapter/bigquery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,11 +1378,11 @@ def _dcl_grants_config_expr(
13781378
self,
13791379
dcl_cmd: t.Type[DCL],
13801380
table: exp.Table,
1381-
grant_config: GrantsConfig,
1381+
grants_config: GrantsConfig,
13821382
table_type: DataObjectType = DataObjectType.TABLE,
13831383
) -> t.List[exp.Expression]:
13841384
expressions: t.List[exp.Expression] = []
1385-
if not grant_config:
1385+
if not grants_config:
13861386
return expressions
13871387

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

14061406
object_kind = self._grant_object_kind(table_type)
1407-
for privilege, principals in grant_config.items():
1407+
for privilege, principals in grants_config.items():
14081408
if not principals:
14091409
continue
14101410

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)