Commit 82b98a2
Feat: unity catalog/delta lake integration (#145)
## Summary
- Add **Unity Catalog** (OSS) integration for browsing catalog metadata
and auto-registering tables into `SqlEngine`
- Introduce **Presto-inspired extensible connector architecture** with
clean separation of catalog metadata (`CatalogProvider`) and data format
reading (`TableReader`)
- Support **Delta Lake** and **Parquet** table formats out of the box
- Support **cloud storage** (S3, Azure, GCS) via `storage_options`
## Architecture
Inspired by [Presto's connector
SPI](https://github.com/prestodb/presto/tree/master/presto-spi/src/main/java/com/facebook/presto/spi/connector):
| Layer | Component | Purpose |
|-------|-----------|---------|
| SPI | `CatalogProvider` trait | Browse catalog metadata (like Presto's
`ConnectorMetadata`) |
| SPI | `TableReader` trait | Read data in specific formats (like
Presto's `ConnectorPageSourceProvider`) |
| Facade | `Connector` struct | Bundles catalog + readers + storage
options (like Presto's `Connector`) |
**Extensibility:**
- New catalog (e.g., AWS Glue) → implement `CatalogProvider`, reuses
existing Delta/Parquet readers
- New format (e.g., Iceberg) → implement `TableReader`, works with any
catalog
## Python API
\`\`\`python
from lance_graph import UnityCatalog
# Connect to Unity Catalog
uc = UnityCatalog("http://localhost:8080/api/2.1/unity-catalog")
# Browse
catalogs = uc.list_catalogs()
tables = uc.list_tables("unity", "default")
table = uc.get_table("unity", "default", "marksheet")
print(table.columns())
# Auto-register Delta + Parquet tables and query via SQL
engine = uc.create_sql_engine("unity", "default")
result = engine.execute("SELECT * FROM marksheet WHERE mark > 80")
# Cloud storage support (S3, Azure, GCS)
uc = UnityCatalog(
"http://localhost:8080/api/2.1/unity-catalog",
storage_options={
"azure_storage_account_name": "myaccount",
"azure_storage_account_key": "...",
}
)
\`\`\`
## New files
**SPI layer** (\`lance-graph-catalog\`):
- \`catalog_provider.rs\` — \`CatalogProvider\` trait + data types
- \`table_reader.rs\` — \`TableReader\` trait with \`storage_options\`
for cloud access
- \`connector.rs\` — \`Connector\` facade bundling catalog + readers +
storage options
- \`type_mapping.rs\` — UC type → Arrow type mapping
- \`unity_catalog.rs\` — OSS UC REST client
**Implementation layer** (\`lance-graph\`):
- \`table_readers.rs\` — \`ParquetTableReader\` + \`DeltaTableReader\`
(via deltalake 0.29)
- \`sql_catalog.rs\` — \`build_context_from_connector()\` bridge to
SqlEngine
**Python bindings** (\`lance-graph-python\`):
- \`catalog.rs\` — UnityCatalog, CatalogInfo, SchemaInfo, TableInfo PyO3
classes
## Test plan
- [x] 12 unit tests for UC type → Arrow type mapping
- [x] 15 wiremock integration tests for UC REST client
- [x] 9 Python unit tests for UnityCatalog class
- [x] 6 Python integration tests (require live UC server, skipped in CI)
- [x] All existing tests pass unchanged (119 Python + 566 Rust)
- [x] README docs updated with UC examples and cloud storage usage
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent af1e4bd commit 82b98a2
25 files changed
Lines changed: 4448 additions & 84 deletions
File tree
- crates
- lance-graph-catalog
- src
- tests
- lance-graph-python/src
- lance-graph
- src
- tests
- python
- python
- lance_graph
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
70 | 129 | | |
71 | 130 | | |
72 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
20 | 27 | | |
21 | 28 | | |
| 29 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
0 commit comments