BYOBI - Creating Views in Your Reader Account
Learn how to create reusable views in your BYOBI - Data Analytics Account to simplify reporting, apply custom logic, and manage data access.
Table of Contents
Overview
Your community’s BYOBI - Data Analytics Account gives you direct SQL access to your community’s Clarity Human Services database. While you can query tables directly, creating views allows you to build reusable, tailored datasets on top of that data.
A view is a saved query that behaves like a table. Views do not copy or store data, so they always reflect the latest information available in the share.
When to Create a View
Views are most useful in the following scenarios:
- Limiting data access for custom roles
If you have created custom roles within your BYOBI - Data Analytics Account, a view can expose only the columns or rows a given team needs. For example, a view might exclude sensitive client fields, and you can grant your reporting role access to the view instead of the underlying table. Or you may want certain users to see only records created by their agency. You can grant your reporting role access only to rows created by that agency. - Joining tables
If your reporting frequently combines the same tables, such as enrollments joined to clients and programs, a view allows you to save that join logic once, so analysts can query a single object instead of rewriting joins each time. - Adding custom logic
Views can embed calculated fields, filters, formatting, or business rules (for example, standardized date ranges, derived categories, or agency-specific filters) so results stay consistent across reports.
How to Create a View
Views must be created in the "<your_site>_SCRATCH" database within your BYOBI - Data Analytics Account, where your role has the appropriate privileges. You cannot create views or other objects inside the PROD_CLARITY_RAW database itself.
Views can be a simple select statement:
CREATE VIEW demo_scratch.organization_views.active_enrollments AS
SELECT cp.id, cp.start_date, cp.end_date
FROM PROD_CLARITY_RAW.CLARITY_DEMO.client_programs cp
Views can limit rows by values of the columns in tables:
CREATE VIEW demo_scratch.organization_views.active_enrollments_agency10 AS
SELECT cp.id, p.name, a.name, cp.start_date, cp.end_date
FROM PROD_CLARITY_RAW.CLARITY_DEMO.client_programs cp
JOIN PROD_CLARITY_RAW.CLARITY_DEMO.data.programs p ON cp.ref_program = p.id
JOIN PROD_CLARITY_RAW.CLARITY_DEMO.agencies a ON p.ref_agency = a.id
WHERE cp.end_date IS NULL;
Views can limit rows by values of the columns in tables:
CREATE VIEW demo_scratch.organization_views.active_enrollments_agency10 AS
SELECT cp.id, cp.start_date, cp.end_date
FROM PROD_CLARITY_RAW.CLARITY_DEMO.client_programs cp
WHERE cp.ref_agency = 10
After creating the view, grant access to the appropriate roles. The role must have USAGE permissions on the database and schema, and SELECT permissions on each view they are allowed to see.
CREATE SCHEMA IF NOT EXISTS DEMO_SCRATCH.organization_views;
GRANT USAGE ON DATABASE DEMO_SCRATCH TO ROLE reporting_role;
GRANT USAGE ON SCHEMA organization_views TO ROLE reporting_role;
GRANT SELECT ON VIEW demo_scratch.organization_views.active_enrollments TO ROLE reporting_role;
Grant the roles to your users:
GRANT ROLE reporting_role TO USER test_user@organization.org;
Additional Resources
For full syntax and configuration options, see Snowflake’s official documentation for CREATE VIEW.
For more information about Snowflake SQL, see Snowflake’s Query Syntax Reference Guide.
Published: 08/03/2026