mirror of
https://github.com/apache/superset.git
synced 2026-04-13 21:24:28 +00:00
fix: RLS in virtual datasets (#36061)
This commit is contained in:
@@ -168,14 +168,7 @@ class RLSTransformer:
|
||||
table_node.catalog if table_node.catalog else self.catalog,
|
||||
)
|
||||
if predicates := self.rules.get(table):
|
||||
return (
|
||||
exp.And(
|
||||
this=predicates[0],
|
||||
expressions=predicates[1:],
|
||||
)
|
||||
if len(predicates) > 1
|
||||
else predicates[0]
|
||||
)
|
||||
return sqlglot.and_(*predicates)
|
||||
|
||||
return None
|
||||
|
||||
@@ -312,6 +305,21 @@ class Table:
|
||||
def __eq__(self, other: Any) -> bool:
|
||||
return str(self) == str(other)
|
||||
|
||||
def qualify(
|
||||
self,
|
||||
*,
|
||||
catalog: str | None = None,
|
||||
schema: str | None = None,
|
||||
) -> Table:
|
||||
"""
|
||||
Return a new Table with the given schema and/or catalog, if not already set.
|
||||
"""
|
||||
return Table(
|
||||
table=self.table,
|
||||
schema=self.schema or schema,
|
||||
catalog=self.catalog or catalog,
|
||||
)
|
||||
|
||||
|
||||
# To avoid unnecessary parsing/formatting of queries, the statement has the concept of
|
||||
# an "internal representation", which is the AST of the SQL statement. For most of the
|
||||
|
||||
Reference in New Issue
Block a user