Skip to content

Commit

Permalink
define snowflake catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
prabodh1194 committed May 1, 2024
1 parent f54d614 commit 3776d38
Show file tree
Hide file tree
Showing 6 changed files with 573 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install-poetry:
pip install poetry==1.8.2

install-dependencies:
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
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

install: | install-poetry install-dependencies

Expand Down
119 changes: 101 additions & 18 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions pyiceberg/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CatalogType(Enum):
GLUE = "glue"
DYNAMODB = "dynamodb"
SQL = "sql"
SNOWFLAKE = "snowflake"


def load_rest(name: str, conf: Properties) -> Catalog:
Expand Down Expand Up @@ -146,12 +147,22 @@ def load_sql(name: str, conf: Properties) -> Catalog:
) from exc


def load_snowflake(name: str, conf: Properties) -> Catalog:
try:
from pyiceberg.catalog.snowflake_catalog import SnowflakeCatalog

return SnowflakeCatalog(name, **conf)
except ImportError as exc:
raise NotInstalledError("Snowflake support not installed: pip install 'pyiceberg[snowflake]'") from exc


AVAILABLE_CATALOGS: dict[CatalogType, Callable[[str, Properties], Catalog]] = {
CatalogType.REST: load_rest,
CatalogType.HIVE: load_hive,
CatalogType.GLUE: load_glue,
CatalogType.DYNAMODB: load_dynamodb,
CatalogType.SQL: load_sql,
CatalogType.SNOWFLAKE: load_snowflake,
}


Expand Down
Loading

0 comments on commit 3776d38

Please sign in to comment.