Using Authorized Views for Project-Specific Pseudo IDs in BigQuery
This tutorial shows you how to maintain a single “master” table with real Connect_ID values while exposing project-specific pseudo_IDs through authorized views. This approach avoids duplicating data across projects and ensures that each project sees only its own pseudo_IDs. The tutorial covers:
- Creating the master table.
- Creating a UDF for project-specific pseudo_ID generation.
- Creating a project-specific authorized view.
- Key maintenance and governance points.
Step 1: Create the Master Table
Store your original data with real Connect_ID values in a master table. Limit access to this table so that only trusted service accounts or administrators can query it directly.
Note: Be sure to set proper access controls on master_table to prevent unauthorized access to real IDs.
Step 2: Create a UDF for Project-Specific Hashing
Create a user-defined function that converts the real Connect_ID into a pseudo_ID. This function incorporates a project-specific salt to generate unique pseudo_IDs per project.
Key Points:
Adjust the salt (
'_SECRET_SALT_FOR_') per project as needed.Ensure that the salt values are stored and managed securely.
This function ensures the same real Connect_ID will yield different pseudo_IDs for different projects.
Step 3: Create a Project-Specific Authorized View
Create a view for each project that selects data from the master table and applies the UDF to transform the Connect_ID into a pseudo_ID. Only grant users access to this view—not to the master table.
For example, for “ProjectA”:
Key Considerations: - Grant the appropriate permissions so that ProjectA users only have access to view_projectA. - Each project can have a similar view but with a project-specific salt or project name.
Maintenance and Governance
When implementing this approach, consider the following maintenance and governance aspects:
Single Source of Truth:
Maintain only one master table, minimizing data duplication and the risk of inconsistencies.Access Control:
Ensure that only authorized users have access to the master table. Each project should only access its authorized view.Data Updates:
As the master table is updated, the authorized views remain valid and reflect the latest data without additional modifications.Security Reviews:
Regularly review the security policies surrounding the mapping function and view access. Rotate salts or update security practices as necessary.Compliance:
Ensure that your setup complies with your organization’s data governance policies and any relevant privacy regulations.
By following these steps, you can keep a secure master dataset while exposing project-specific pseudo_IDs via authorized views. This approach limits the risk of cross-project re-identification and adheres to best practices in data security and governance.
Internal Example:
NCCR - state registry
Johanna
Use a CBIIT-blessed algorithm