# annabogo-hubs/snowflake-permissions architecture

> Architecture diagram of the GitHub repository annabogo-hubs/snowflake-permissions, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/annabogo-hubs/snowflake-permissions
- Repository: https://github.com/annabogo-hubs/snowflake-permissions

## Overview

##### Processing Layer
- Center the main script components (script.ipynb, query.py)
- As a process block or hexagon
- Configuration template (config.template.yaml) connected to this layer

##### Snowflake Integration Layer
- Three main aspects of Snowflake's access control:
- Users
- Roles
- Resource Access (Warehouses, Databases, Schemas)

**[Configuration Files Layer]**
- ↓
**[Processing Layer]**
- ↓
**[Snowflake Platform Layer]**

##### Specific relationships
- How users.yaml defines user-to-role mappings
- How roles.yaml defines role hierarchies and resource access
- Demonstrate the flow of permission updates to Snowflake

##### Additional Details
- A note about MFA configuration
- Parent_role relationship concept

- The declarative nature of the configuration (YAML files)
- The separation between configuration and execution
- The hierarchical role structure in Snowflake
- The three-level permission model (read, create, own)

##### Validation step where current permissions are checked against desired state

- Clear hierarchical layouts
- Nested components (especially for the Snowflake layer)
- Text annotations for important notes

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef config fill:#e1f5fe,stroke:#01579b
    classDef process fill:#c8e6c9,stroke:#2e7d32
    classDef snowflake fill:#bbdefb,stroke:#0d47a1
    classDef arrow stroke:#000000
    classDef writeArrow stroke:#ff0000

    %% Configuration Layer
    subgraph ConfigLayer["Configuration Layer"]
        Users["users.yaml"]:::config
        Roles["roles.yaml"]:::config
        ConfigTemplate["config.template.yaml"]:::config
    end

    %% Processing Layer
    subgraph ProcessLayer["Processing Layer"]
        MainScript["script.ipynb"]:::process
        QueryInterface["query.py"]:::process
    end

    %% Snowflake Layer
    subgraph SnowflakeLayer["Snowflake Platform"]
        subgraph AccessControl["Access Control"]
            SFUsers["Users"]:::snowflake
            SFRoles["Roles"]:::snowflake
        end
        
        subgraph Resources["Resources"]
            Warehouses["Warehouses"]:::snowflake
            Databases["Databases"]:::snowflake
            Schemas["Schemas"]:::snowflake
        end
    end

    %% Relationships
    Users --> MainScript
    Roles --> MainScript
    ConfigTemplate --> MainScript
    MainScript --> QueryInterface
    QueryInterface -.-> AccessControl
    QueryInterface -.-> Resources

    %% Legend
    subgraph Legend["Legend"]
        L1["Configuration Files"]:::config
        L2["Processing Components"]:::process
        L3["Snowflake Components"]:::snowflake
    end

    %% Notes
    note["Note: User creation is manual and outside tool scope"]

    %% Click Events
    click Users "https://github.com/annabogo-hubs/snowflake-permissions/blob/master/users.yaml"
    click Roles "https://github.com/annabogo-hubs/snowflake-permissions/blob/master/roles.yaml"
    click MainScript "https://github.com/annabogo-hubs/snowflake-permissions/blob/master/script.ipynb"
    click QueryInterface "https://github.com/annabogo-hubs/snowflake-permissions/blob/master/query.py"
    click ConfigTemplate "https://github.com/annabogo-hubs/snowflake-permissions/blob/master/config.template.yaml"
```
