4949from pytest_lazy_fixtures import lf
5050
5151from pyiceberg .catalog import Catalog , load_catalog
52- from pyiceberg .catalog .bigquery_metastore import BigQueryMetastoreCatalog
53- from pyiceberg .catalog .dynamodb import DynamoDbCatalog
54- from pyiceberg .catalog .glue import GlueCatalog
55- from pyiceberg .catalog .hive import HiveCatalog
56- from pyiceberg .catalog .memory import InMemoryCatalog
57- from pyiceberg .catalog .noop import NoopCatalog
58- from pyiceberg .catalog .rest import RestCatalog
59- from pyiceberg .catalog .sql import SqlCatalog
6052from pyiceberg .expressions import BoundReference
6153from pyiceberg .io import (
6254 ADLS_ACCOUNT_KEY ,
@@ -2497,6 +2489,8 @@ def warehouse(tmp_path_factory: pytest.TempPathFactory) -> Path:
24972489
24982490@pytest .fixture
24992491def table_v1 (example_table_metadata_v1 : dict [str , Any ]) -> Table :
2492+ from pyiceberg .catalog .noop import NoopCatalog
2493+
25002494 table_metadata = TableMetadataV1 (** example_table_metadata_v1 )
25012495 return Table (
25022496 identifier = ("database" , "table" ),
@@ -2509,6 +2503,8 @@ def table_v1(example_table_metadata_v1: dict[str, Any]) -> Table:
25092503
25102504@pytest .fixture
25112505def table_v2 (example_table_metadata_v2 : dict [str , Any ]) -> Table :
2506+ from pyiceberg .catalog .noop import NoopCatalog
2507+
25122508 table_metadata = TableMetadataV2 (** example_table_metadata_v2 )
25132509 return Table (
25142510 identifier = ("database" , "table" ),
@@ -2521,6 +2517,8 @@ def table_v2(example_table_metadata_v2: dict[str, Any]) -> Table:
25212517
25222518@pytest .fixture
25232519def table_v3 (example_table_metadata_v3 : dict [str , Any ]) -> Table :
2520+ from pyiceberg .catalog .noop import NoopCatalog
2521+
25242522 table_metadata = TableMetadataV3 (** example_table_metadata_v3 )
25252523 return Table (
25262524 identifier = ("database" , "table" ),
@@ -2535,6 +2533,8 @@ def table_v3(example_table_metadata_v3: dict[str, Any]) -> Table:
25352533def table_v2_orc (example_table_metadata_v2 : dict [str , Any ]) -> Table :
25362534 import copy
25372535
2536+ from pyiceberg .catalog .noop import NoopCatalog
2537+
25382538 metadata_dict = copy .deepcopy (example_table_metadata_v2 )
25392539 if not metadata_dict ["properties" ]:
25402540 metadata_dict ["properties" ] = {}
@@ -2553,6 +2553,8 @@ def table_v2_orc(example_table_metadata_v2: dict[str, Any]) -> Table:
25532553def table_v2_with_fixed_and_decimal_types (
25542554 table_metadata_v2_with_fixed_and_decimal_types : dict [str , Any ],
25552555) -> Table :
2556+ from pyiceberg .catalog .noop import NoopCatalog
2557+
25562558 table_metadata = TableMetadataV2 (
25572559 ** table_metadata_v2_with_fixed_and_decimal_types ,
25582560 )
@@ -2567,6 +2569,8 @@ def table_v2_with_fixed_and_decimal_types(
25672569
25682570@pytest .fixture
25692571def table_v2_with_extensive_snapshots (example_table_metadata_v2_with_extensive_snapshots : dict [str , Any ]) -> Table :
2572+ from pyiceberg .catalog .noop import NoopCatalog
2573+
25702574 table_metadata = TableMetadataV2 (** example_table_metadata_v2_with_extensive_snapshots )
25712575 return Table (
25722576 identifier = ("database" , "table" ),
@@ -2579,6 +2583,8 @@ def table_v2_with_extensive_snapshots(example_table_metadata_v2_with_extensive_s
25792583
25802584@pytest .fixture
25812585def table_v2_with_statistics (table_metadata_v2_with_statistics : dict [str , Any ]) -> Table :
2586+ from pyiceberg .catalog .noop import NoopCatalog
2587+
25822588 table_metadata = TableMetadataV2 (** table_metadata_v2_with_statistics )
25832589 return Table (
25842590 identifier = ("database" , "table" ),
@@ -3000,11 +3006,15 @@ def ray_session() -> Generator[Any, None, None]:
30003006# Catalog fixtures
30013007
30023008
3003- def _create_memory_catalog (name : str , warehouse : Path ) -> InMemoryCatalog :
3009+ def _create_memory_catalog (name : str , warehouse : Path ) -> Catalog :
3010+ from pyiceberg .catalog .memory import InMemoryCatalog
3011+
30043012 return InMemoryCatalog (name , warehouse = f"file://{ warehouse } " )
30053013
30063014
3007- def _create_sql_catalog (name : str , warehouse : Path ) -> SqlCatalog :
3015+ def _create_sql_catalog (name : str , warehouse : Path ) -> Catalog :
3016+ from pyiceberg .catalog .sql import SqlCatalog
3017+
30083018 catalog = SqlCatalog (
30093019 name ,
30103020 uri = "sqlite:///:memory:" ,
@@ -3014,7 +3024,9 @@ def _create_sql_catalog(name: str, warehouse: Path) -> SqlCatalog:
30143024 return catalog
30153025
30163026
3017- def _create_sql_without_rowcount_catalog (name : str , warehouse : Path ) -> SqlCatalog :
3027+ def _create_sql_without_rowcount_catalog (name : str , warehouse : Path ) -> Catalog :
3028+ from pyiceberg .catalog .sql import SqlCatalog
3029+
30183030 props = {
30193031 "uri" : f"sqlite:////{ warehouse } /sql-catalog" ,
30203032 "warehouse" : f"file://{ warehouse } " ,
@@ -3152,48 +3164,83 @@ def test_table_properties() -> dict[str, str]:
31523164
31533165
31543166def does_support_purge_table (catalog : Catalog ) -> bool :
3167+ from pyiceberg .catalog .noop import NoopCatalog
3168+ from pyiceberg .catalog .rest import RestCatalog
3169+
31553170 if isinstance (catalog , RestCatalog ):
31563171 return property_as_bool (catalog .properties , "supports_purge_table" , True )
3172+ from pyiceberg .catalog .hive import HiveCatalog
3173+
31573174 if isinstance (catalog , (HiveCatalog , NoopCatalog )):
31583175 return False
31593176 return True
31603177
31613178
31623179def does_support_atomic_concurrent_updates (catalog : Catalog ) -> bool :
3180+ from pyiceberg .catalog .noop import NoopCatalog
3181+ from pyiceberg .catalog .rest import RestCatalog
3182+
31633183 if isinstance (catalog , RestCatalog ):
31643184 return property_as_bool (catalog .properties , "supports_atomic_concurrent_updates" , True )
3185+ from pyiceberg .catalog .hive import HiveCatalog
3186+
31653187 if isinstance (catalog , (HiveCatalog , NoopCatalog )):
31663188 return False
31673189 return True
31683190
31693191
31703192def does_support_nested_namespaces (catalog : Catalog ) -> bool :
3193+ from pyiceberg .catalog .dynamodb import DynamoDbCatalog
3194+ from pyiceberg .catalog .glue import GlueCatalog
3195+ from pyiceberg .catalog .noop import NoopCatalog
3196+ from pyiceberg .catalog .rest import RestCatalog
3197+
31713198 if isinstance (catalog , RestCatalog ):
31723199 return property_as_bool (catalog .properties , "supports_nested_namespaces" , True )
3173- if isinstance (catalog , (HiveCatalog , NoopCatalog , GlueCatalog , BigQueryMetastoreCatalog , DynamoDbCatalog )):
3200+ from pyiceberg .catalog .bigquery_metastore import BigQueryMetastoreCatalog
3201+ from pyiceberg .catalog .hive import HiveCatalog
3202+
3203+ if isinstance (catalog , (HiveCatalog , BigQueryMetastoreCatalog , NoopCatalog , GlueCatalog , DynamoDbCatalog )):
31743204 return False
31753205 return True
31763206
31773207
31783208def does_support_schema_evolution (catalog : Catalog ) -> bool :
3209+ from pyiceberg .catalog .noop import NoopCatalog
3210+ from pyiceberg .catalog .rest import RestCatalog
3211+
31793212 if isinstance (catalog , RestCatalog ):
31803213 return property_as_bool (catalog .properties , "supports_schema_evolution" , True )
3214+ from pyiceberg .catalog .hive import HiveCatalog
3215+
31813216 if isinstance (catalog , (HiveCatalog , NoopCatalog )):
31823217 return False
31833218 return True
31843219
31853220
31863221def does_support_slash_in_identifier (catalog : Catalog ) -> bool :
3222+ from pyiceberg .catalog .noop import NoopCatalog
3223+ from pyiceberg .catalog .rest import RestCatalog
3224+ from pyiceberg .catalog .sql import SqlCatalog
3225+
31873226 if isinstance (catalog , RestCatalog ):
31883227 return property_as_bool (catalog .properties , "supports_slash_in_identifier" , True )
3228+ from pyiceberg .catalog .hive import HiveCatalog
3229+
31893230 if isinstance (catalog , (HiveCatalog , NoopCatalog , SqlCatalog )):
31903231 return False
31913232 return True
31923233
31933234
31943235def does_support_dot_in_identifier (catalog : Catalog ) -> bool :
3236+ from pyiceberg .catalog .noop import NoopCatalog
3237+ from pyiceberg .catalog .rest import RestCatalog
3238+ from pyiceberg .catalog .sql import SqlCatalog
3239+
31953240 if isinstance (catalog , RestCatalog ):
31963241 return property_as_bool (catalog .properties , "supports_dot_in_identifier" , True )
3242+ from pyiceberg .catalog .hive import HiveCatalog
3243+
31973244 if isinstance (catalog , (HiveCatalog , NoopCatalog , SqlCatalog )):
31983245 return False
31993246 return True
0 commit comments