You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/07/26 20:56:04 UTC
[GitHub] [iceberg] samredai commented on a diff in pull request #5360: [Python] Remove all base.py, use __init__.py where it works
samredai commented on code in PR #5360:
URL: https://github.com/apache/iceberg/pull/5360#discussion_r930404656
##########
python/tests/catalog/test_catalog.py:
##########
@@ -20,43 +20,43 @@
List,
Optional,
Set,
+ Tuple,
Union,
)
import pytest
-from pyiceberg.catalog import Identifier, Properties
-from pyiceberg.catalog.base import Catalog
+from pyiceberg.catalog import Catalog
from pyiceberg.exceptions import (
AlreadyExistsError,
NamespaceNotEmptyError,
NoSuchNamespaceError,
NoSuchTableError,
)
from pyiceberg.schema import Schema
-from pyiceberg.table.base import Table
+from pyiceberg.table import Table
from pyiceberg.table.metadata import INITIAL_SPEC_ID
from pyiceberg.table.partitioning import PartitionSpec
class InMemoryCatalog(Catalog):
"""An in-memory catalog implementation for testing purposes."""
- __tables: Dict[Identifier, Table]
- __namespaces: Dict[Identifier, Properties]
+ __tables: Dict[Tuple[str, ...], Table]
Review Comment:
Unless I messed something up here, this was causing a circular import:
```
ImportError while loading conftest '/Users/sam/iceberg/python/tests/conftest.py'.
tests/conftest.py:55: in <module>
from tests.catalog.test_catalog import InMemoryCatalog
tests/catalog/test_catalog.py:28: in <module>
from pyiceberg.catalog import Catalog, Identifier, Properties
pyiceberg/catalog/__init__.py:24: in <module>
from pyiceberg.tableimport Table
pyiceberg/table/__init__.py:22: in <module>
from pyiceberg.catalog.base import Identifier
E ImportError: cannot import name 'Identifier' from partially initialized module 'pyiceberg.catalog' (most likely due to a circular import) (/Users/sam/iceberg/python/pyiceberg/catalog/__init__.py)
```
Essentially from [this](https://github.com/apache/iceberg/blob/master/python/pyiceberg/table/base.py#L22) line. If there's a way to avoid this and still use `__init__.py` I can update this. Although I do wonder how informative a type of `Identifier` is versus `Tuple[str, ...]`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org