Skip to content

Commit 3776d38

Browse files
committed
define snowflake catalog
1 parent f54d614 commit 3776d38

File tree

6 files changed

+573
-79
lines changed

6 files changed

+573
-79
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ install-poetry:
1919
pip install poetry==1.8.2
2020

2121
install-dependencies:
22-
poetry install -E pyarrow -E hive -E s3fs -E glue -E adlfs -E duckdb -E ray -E sql-postgres -E gcsfs -E sql-sqlite -E daft
22+
poetry install -E pyarrow -E hive -E s3fs -E glue -E adlfs -E duckdb -E ray -E sql-postgres -E gcsfs -E sql-sqlite -E daft -E snowflake
2323

2424
install: | install-poetry install-dependencies
2525

poetry.lock

+101-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyiceberg/catalog/__init__.py

+11
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class CatalogType(Enum):
100100
GLUE = "glue"
101101
DYNAMODB = "dynamodb"
102102
SQL = "sql"
103+
SNOWFLAKE = "snowflake"
103104

104105

105106
def load_rest(name: str, conf: Properties) -> Catalog:
@@ -146,12 +147,22 @@ def load_sql(name: str, conf: Properties) -> Catalog:
146147
) from exc
147148

148149

150+
def load_snowflake(name: str, conf: Properties) -> Catalog:
151+
try:
152+
from pyiceberg.catalog.snowflake_catalog import SnowflakeCatalog
153+
154+
return SnowflakeCatalog(name, **conf)
155+
except ImportError as exc:
156+
raise NotInstalledError("Snowflake support not installed: pip install 'pyiceberg[snowflake]'") from exc
157+
158+
149159
AVAILABLE_CATALOGS: dict[CatalogType, Callable[[str, Properties], Catalog]] = {
150160
CatalogType.REST: load_rest,
151161
CatalogType.HIVE: load_hive,
152162
CatalogType.GLUE: load_glue,
153163
CatalogType.DYNAMODB: load_dynamodb,
154164
CatalogType.SQL: load_sql,
165+
CatalogType.SNOWFLAKE: load_snowflake,
155166
}
156167

157168

0 commit comments

Comments
 (0)