You now have a complete, production-ready SnowGuard Framework with:
-- Copy the entire contents of:
-- database/INSTALL_RBAC_METADATA.ddl
-- Execute in your Snowflake account as SYSADMIN role
USE ROLE SYSADMIN;
-- Paste and execute the DDL script
-- Confirm tables exist
SELECT COUNT(*) FROM ADW_CONTROL.audit.adw_rbac_metadata;
SELECT COUNT(*) FROM ADW_CONTROL.audit.adw_rbac_audit_log;
cd "C:\Users\atadas\Downloads\Eligibility\snowflake-role-based-access"
.venv\Scripts\Activate.ps1
cd app
streamlit run main.py
Open browser to: http://localhost:8501
snowflake-role-based-access/
β
βββ π DOCUMENTATION
β βββ README.md # Main project guide
β βββ RBAC_Framework_Handbook.md # Architecture & design
β βββ IMPLEMENTATION_SUMMARY.md # What's been updated
β βββ DATA_FLOW_INTEGRATION.md # How layers interact
β βββ INDEX.md # Navigation guide
β
βββ ποΈ DATABASE
β βββ INSTALL_RBAC_METADATA.ddl # β USE THIS - Master installer
β βββ adw_rbac_metadata.ddl # Individual table DDL
β βββ adw_rbac_audit_log.ddl # Individual table DDL
β βββ README.md # DDL reference guide
β
βββ π― STREAMLIT APPLICATION
β βββ main.py # β Main dashboard (UPDATED)
β βββ requirements.txt # Python dependencies
β βββ config.ini # Application config
β
βββ π SUPPORTING
βββ INSTALLATION_GUIDE.md
βββ PACKAGE_SUMMARY.md
βββ FILE_STRUCTURE.md
| Table | Purpose | Rows | Indexes |
|---|---|---|---|
audit.adw_rbac_metadata |
Permission mappings | 1000s | 5 strategic indexes |
audit.adw_rbac_audit_log |
Operation history | 100,000s | 5 performance indexes |
| View Name | Purpose | Data Source |
|---|---|---|
vw_active_rbac_metadata |
Current effective permissions | Metadata table |
vw_successful_rbac_operations |
Successful grants/revokes | Audit log |
vw_failed_rbac_operations |
Failed operations | Audit log |
vw_rbac_operations_summary |
Daily operation stats | Audit log |
Streamlit Dashboard
β SELECT
audit.vw_active_rbac_metadata
β WHERE effective_dates & status
audit.adw_rbac_metadata
β
Display current permissions
User enters permission in UI
β INSERT
audit.adw_rbac_metadata
β (record_create_ts auto-set)
New permission ready for grants
β
Can execute USP_GRANT_RBAC procedure
GRANT/REVOKE executed
β INSERT
audit.adw_rbac_audit_log
β (log_id auto-increment)
Operation recorded with status
β
Available in vw_successful_rbac_operations
or vw_failed_rbac_operations
All 14 columns from handbook are implemented:
| Column | Type | Handbook Reference | UI Field |
|---|---|---|---|
| rbac_id | NUMBER | Primary Key | Auto-generated |
| database_name | VARCHAR | Database name | Dropdown/Input |
| schema_name | VARCHAR | Schema name | Dropdown/Input |
| table_name | VARCHAR | Table name | Dropdown/Input |
| role_name | VARCHAR | Role name | Dropdown/Input |
| permission_type | VARCHAR | SELECT/INSERT/UPDATE/DELETE/ALL | Dropdown |
| effective_start_date | DATE | When active | Date picker |
| effective_end_date | DATE | When expires | Date picker |
| description | VARCHAR | Why granted | Text field |
| record_status_cd | VARCHAR | Active/Inactive | Toggle |
| record_created_by | VARCHAR | Creator | Auto-capture |
| record_create_ts | TIMESTAMP | Created when | Auto-capture |
| record_updated_by | VARCHAR | Last modifier | Auto-capture |
| record_updated_ts | TIMESTAMP | Last updated | Auto-capture |
All 15 columns from handbook are implemented:
| Column | Type | Purpose |
|---|---|---|
| log_id | NUMBER | Unique operation ID |
| operation_type | VARCHAR | GRANT/REVOKE/DRY_RUN |
| database_name | VARCHAR | Target database |
| schema_name | VARCHAR | Target schema |
| table_name | VARCHAR | Target table |
| role_name | VARCHAR | Target role |
| permission_type | VARCHAR | Permission granted/revoked |
| sql_statement | VARCHAR | Actual SQL used |
| execution_status | VARCHAR | SUCCESS/FAILED/PENDING |
| error_message | VARCHAR | Error details if failed |
| execution_time | TIMESTAMP | When executed |
| record_status_cd | VARCHAR | Active/Inactive |
| record_created_by | VARCHAR | Who executed |
| record_create_ts | TIMESTAMP | Log time |
| record_updated_by | VARCHAR | Last updater |
# Via Streamlit UI:
1. Go to "π Add Permission" page
2. Enter:
- Database: ADW_PROD
- Schema: ADS
- Table: T_CUSTOMER
- Role: ANALYST_ROLE
- Permission: SELECT
- Effective Start: Today
- Description: "Read access to customer table"
3. Click "Add Permission"
# Automatically inserts into audit.adw_rbac_metadata
# Via Streamlit UI:
1. Go to "π Audit Log" page
2. Filter by:
- Date range
- Operation type
- Status (Success/Failed)
- User
3. View detailed operation information
# Reads from audit.adw_rbac_audit_log views
# Via Streamlit UI:
1. Go to "π Metadata Management" page
2. View all active permissions
3. Filter by role/database as needed
# Queries vw_active_rbac_metadata view
-- Via Snowflake:
-- After adding permissions to metadata table
CALL audit.USP_GRANT_RBAC(
p_dry_run_flag => 'N' -- Change to 'Y' for testing
);
-- Operation logged to audit.adw_rbac_audit_log
After setup, verify:
ADW_CONTROL createdADW_CONTROL.audit createdadw_rbac_metadata exists with 14 columnsadw_rbac_audit_log exists with 15 columns-- Run this verification script:
SELECT 'Tables' as object_type, COUNT(*) as count
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'AUDIT'
AND TABLE_NAME LIKE 'ADW_RBAC%'
UNION ALL
SELECT 'Views', COUNT(*)
FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_SCHEMA = 'AUDIT'
AND TABLE_NAME LIKE 'VW_%';
Solution: Activate virtual environment first
.venv\Scripts\Activate.ps1
Solution:
config.iniSolution: Execute INSTALL_RBAC_METADATA.ddl as SYSADMIN or ACCOUNTADMIN role
Solution: Verify DDL executed completely - check for errors in output
| Document | Purpose | Read When |
|---|---|---|
| RBAC_Framework_Handbook.md | Architecture & design | Understanding the system |
| IMPLEMENTATION_SUMMARY.md | What was updated | Understanding changes |
| DATA_FLOW_INTEGRATION.md | How layers work together | Understanding data flow |
| database/README.md | DDL reference | Deploying to Snowflake |
| README.md | Project overview | Getting started |
All permissions are stored as data in adw_rbac_metadata, not hard-coded. This allows:
Permissions have start and end dates:
effective_start_date: When permission becomes activeeffective_end_date: When permission expires (optional)Every operation is logged in adw_rbac_audit_log:
record_status_cd = 'A': Active (applies to permissions)record_status_cd = 'I': Inactive (archived/disabled)All components are integrated and ready to use:
Next Steps:
Version: 1.0
Created: December 3, 2025
Status: β
Complete & Ready for Production