Skip to content

Commit 6089ca2

Browse files
committed
feat: implement InMemoryCatalog as a subclass of SqlCatalog
1 parent 052a9cd commit 6089ca2

File tree

3 files changed

+111
-271
lines changed

3 files changed

+111
-271
lines changed

pyiceberg/catalog/memory.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from pyiceberg.catalog.sql import SqlCatalog
2+
3+
4+
class InMemoryCatalog(SqlCatalog):
5+
"""
6+
An in-memory catalog implementation that uses SqlCatalog with SQLite in-memory database.
7+
8+
This is useful for test, demo, and playground but not in production as data is not persisted.
9+
"""
10+
11+
def __init__(self, name: str, warehouse: str = "file:///tmp/warehouse", **kwargs: str) -> None:
12+
self._warehouse_location = warehouse
13+
if "uri" not in kwargs:
14+
kwargs["uri"] = "sqlite:///:memory:"
15+
super().__init__(name=name, warehouse=warehouse, **kwargs)

0 commit comments

Comments
 (0)