Source code for deephaven_enterprise.acl_generator
# Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending
import jpy
from deephaven.jcompat import j_array_list
from deephaven.table import Table
_j_generator_type = jpy.get_type(
"io.deephaven.enterprise.acl.AclFilterGenerator")
[docs]def full_access():
"""
Create a filter generator that gives full access to the table.
:return: a generator for full access
"""
return _j_generator_type.fullAccess()
[docs]def no_access():
"""
Create a filter generator that gives no access to the table.
:return: a generator for no access
"""
return _j_generator_type.noAccess()
[docs]def group(group_column: str, matches_set: bool = False):
"""
Create a filter generator that filters rows based on group data contained within the table.
:param group_column: the column containing the group data
:param matches_set: if the filter should match groups within a column that is a list or array or groups (defaults to False)
:return: a generator that filters based on group data in the table
"""
return _j_generator_type.group(group_column, matches_set)
[docs]def where(*filters: str):
"""
Create a filter generator from a set of simple where clauses.
:param filters: the filters to apply
:return: a generator that applies the defined clauses
"""
return _j_generator_type.where(*filters)
[docs]def where_in(set_namespace: str, set_table_name: str, set_group_column: str, set_filters: list,
use_historical: bool, *match_expressions: str):
"""
Create a filter generator that applies a where_in() filter from a "Set" table containing the grouping information
:param set_namespace: the namespace of the "Set" table
:param set_table_name: the table name of the "Set" table
:param set_group_column: the column in the "Set" table containing the group information
:param set_filters: a set of expressions to filter the "Set" table
:param use_historical: if the "Set" table should ceom from the historical data store
:param match_expressions: the set of columns to match between the two tables
:return: a filter generator that creates where_in filters
"""
return _j_generator_type.whereIn(set_namespace, set_table_name, set_group_column, j_array_list(set_filters),
use_historical, *match_expressions)
[docs]def where_in_table(set_table: Table, set_group_column: str, set_filters: list, *match_expressions: str):
"""
Create a filter generator that applies a where_in() filter from a "Set" table containing the grouping information
:param set_table: the set table
:param set_group_column: the column in the "Set" table containing the group information
:param set_filters: a set of expressions to filter the "Set" table
:param match_expressions: the set of columns to match between the two tables
:return: a filter generator that creates where_in filters
"""
return _j_generator_type.whereIn(set_table.j_table, set_group_column, j_array_list(set_filters), *match_expressions)
[docs]def conjunctive(*generators: _j_generator_type):
"""
Create a filter generator that conjunctively combines the input generators
:param generators: the generators to combine
:return: a conjunctive filter generator
"""
return _j_generator_type.conjunctive(*generators)
[docs]def disjunctive(*generators: _j_generator_type):
"""
Create a filter generator that disjunctively combines the input generators
:param generators: the generators to combine
:return: a disjunctively filter generator
"""
return _j_generator_type.disjunctive(*generators)