# dasenf1860/fabricdatabricksunitycatalog architecture

> Architecture diagram of the GitHub repository dasenf1860/fabricdatabricksunitycatalog, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dasenf1860/fabricdatabricksunitycatalog
- Repository: https://github.com/dasenf1860/fabricdatabricksunitycatalog

## Overview

##### Project Type and Purpose
- The project is essentially a data engineering integration solution. It is not a full-scale application but rather a guide with accompanying notebooks (UnityCatalogAPI.ipynb and UnityCatalogExternal.ipynb) that demonstrate how to interact with the Databricks Unity Catalog and Microsoft Fabric.
- Its purpose is to show how to set up table shortcuts so that Fabric Lakehouses can reference tables maintained in Databricks Unity Catalog without data duplication.
- The integration uses API calls (and can be extended via CLI/SDK) to convert storage paths between the systems and to synchronize metadata across platforms.

##### File Structure
- Top-level files include: LICENSE, README.md, two IPython notebooks (UnityCatalogAPI.ipynb, UnityCatalogExternal.ipynb), and a media directory containing images.
- The notebooks likely contain code examples for making API calls and processing path conversions which are core to the integration.
- The simple file structure indicates that the project focuses on the integration process rather than a multi-component application system.

a. Databricks Environment:
- Unity Catalog
- Catalog (e.g., “healthcare”)
- Schemas (e.g., “clinicaltrialssilver”)
- Tables (subject, adverse_events, measurements)
- API/CLI/SDK Usage:
- A component that represents the code (as demonstrated in the notebooks) which programmatically retrieves table metadata and performs the path conversion.
b. Microsoft Fabric Environment:
- Fabric Lakehouse
- Displays the table shortcut that mirrors a Databricks Unity Catalog table.
- Uses OneLake-Shortcuts so that even though the data physically resides in ADLS, it is referenced in Fabric.
c. Underlying Storage:
- Azure Data Lake Storage Gen2 (ADLS Gen2)
- The underlying storage where the delta tables reside.
- Both Unity Catalog and Fabric point to the same delta files on ADLS.
d. Messaging and Data Flow:
- API Layer:
- Data flows from Databricks metadata (table details and file paths) to Fabric, where the API or code layer converts and sets up the appropriate shortcut links.
- Integration Flow:
- From external API calls/CLI/SDK (as explained in the notebooks) to Fabric’s Lakehouse table creation process.

##### Relationships and Interactions
- The process of querying Unity Catalog tables and extracting table detail (including ADLS path).
- The conversion step where the abfss path is transformed to an https path suitable for Fabric.
- The creation of a table shortcut in Fabric that points back to the Unity Catalog source.
- That both metadata definitions (in Unity Catalog and in Fabric) ultimately reference the same underlying storage objects.
- Interconnectivity with a bidirectional note (if future enhancements allow sync in both directions) or simply one-way data flow (from Databricks to Fabric, as currently described).

##### Highlighting Architectural Patterns or Design Principles
- Stress “seamless integration” with minimal data movement — only metadata and path transformations take place.
- Pattern of using a thin intermediary layer (the API/CLI/SDK component) to connect two distinct data platforms.

- Via an intermediate block labeled “Integration Code (API/CLI/SDK)” that handles the process of extracting table details and converting paths.
- Separation of responsibilities and the minimal-effort, non-replicative data access characteristic of the design.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Databricks Environment Subgraph
    subgraph "Databricks Environment"
        DUC["\"Databricks Unity Catalog\""]:::platform
        DUCat["\"Catalog: healthcare\""]:::info
        DUSchema["\"Schema: clinicaltrialssilver\""]:::info
        DUTables["\"Tables: subject, adverse_events, measurements\""]:::info
    end
    DUC --> DUCat
    DUCat --> DUSchema
    DUSchema --> DUTables

    %% Integration API/CLI/SDK Layer
    API["\"Integration API/CLI/SDK Layer\""]:::api

    %% Microsoft Fabric Lakehouse
    Fabric["\"Microsoft Fabric Lakehouse\""]:::platform

    %% Underlying Storage (ADLS Gen2)
    ADLS["\"Azure Data Lake Storage Gen2\""]:::storage

    %% Media and Documentation
    Media["\"Media and Documentation\""]:::doc

    %% Data Flow Relationships
    DUC -->|"queriesMetadata"| API
    API -->|"convertsPath"| Fabric
    DUCat -.->|"referencesStorage"| ADLS
    Fabric -.->|"referencesStorage"| ADLS

    %% Future Enhancement (Optional Two-Way Sync)
    Future["\"Future Sync Enhancements\""]:::future
    API -->|"potentialSync"| Future
    Future -->|"replicatesMetadata"| API

    %% Media usage association
    Media --- DUC

    %% Click Events
    click DUC "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogAPI.ipynb"
    click DUC "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogExternal.ipynb"
    click API "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogAPI.ipynb"
    click API "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogExternal.ipynb"
    click Fabric "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogAPI.ipynb"
    click Fabric "https://github.com/dasenf1860/fabricdatabricksunitycatalog/blob/main/UnityCatalogExternal.ipynb"
    click Media "https://github.com/dasenf1860/fabricdatabricksunitycatalog/tree/main/media"

    %% Styles
    classDef platform fill:#ffccf9,stroke:#333,stroke-width:2px;
    classDef api fill:#bbd7f7,stroke:#333,stroke-width:2px;
    classDef storage fill:#c4f7c4,stroke:#333,stroke-width:2px;
    classDef doc fill:#fff4b3,stroke:#333,stroke-width:2px;
    classDef info fill:#e0e0e0,stroke:#666,stroke-width:1px;
    classDef future fill:#f7c4c4,stroke:#333,stroke-width:2px;
```
