How to use the pydomo.datasets.PolicyFilter function in pydomo

To help you get started, we’ve selected a few pydomo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github domoinc / domo-python-sdk / run_examples.py View on Github external
csv_file.close()
        domo.logger.info("Downloaded data as a file from DataSet {}".format(
            dataset['id']))

        # Import Data from a file
        csv_file_path = './math.csv'
        datasets.data_import_from_file(dataset['id'], csv_file_path)
        domo.logger.info("Uploaded data from a file to DataSet {}".format(
            dataset['id']))

        #########################################
        # Personalized Data Policies (PDPs)
        #########################################

        # Build a Policy Filter (hide sensitive columns/values from users)
        pdp_filter = PolicyFilter()
        pdp_filter.column = 'Attending'  # The DataSet column to filter on
        pdp_filter.operator = FilterOperator.EQUALS
        pdp_filter.values = ['TRUE']  # The DataSet row value to filter on

        # Build the Personalized Data Policy (PDP)
        pdp_request = Policy()
        pdp_request.name = 'Only show friends attending the party'
        # A single PDP can contain multiple filters
        pdp_request.filters = [pdp_filter]
        pdp_request.type = PolicyType.USER
        # The affected user ids (restricted access by filter)
        pdp_request.users = [998, 999]
        # The affected group ids (restricted access by filter)
        pdp_request.groups = [99, 100]

        # Create the PDP