Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/catalog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def infer_catalog_type(name: str, catalog_properties: RecursiveDict) -> Optional
Raises:
ValueError: Raises a ValueError in case properties are missing, or the wrong type.
"""
if uri := catalog_properties.get("uri"):
if uri := catalog_properties.get(URI):
if isinstance(uri, str):
if uri.startswith("http"):
return CatalogType.REST
Expand Down
5 changes: 3 additions & 2 deletions pyiceberg/catalog/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
LOCATION,
METADATA_LOCATION,
TABLE_TYPE,
URI,
MetastoreCatalog,
PropertiesUpdateSummary,
)
Expand Down Expand Up @@ -307,7 +308,7 @@ def __init__(self, name: str, **properties: str):
@staticmethod
def _create_hive_client(properties: Dict[str, str]) -> _HiveClient:
last_exception = None
for uri in properties["uri"].split(","):
for uri in properties[URI].split(","):
try:
return _HiveClient(
uri,
Expand All @@ -319,7 +320,7 @@ def _create_hive_client(properties: Dict[str, str]) -> _HiveClient:
if last_exception is not None:
raise last_exception
else:
raise ValueError(f"Unable to connect to hive using uri: {properties['uri']}")
raise ValueError(f"Unable to connect to hive using uri: {properties[URI]}")

def _convert_hive_into_iceberg(self, table: HiveTable) -> Table:
properties: Dict[str, str] = table.parameters
Expand Down
5 changes: 3 additions & 2 deletions pyiceberg/catalog/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.

from pyiceberg.catalog import URI
from pyiceberg.catalog.sql import SqlCatalog


Expand All @@ -27,6 +28,6 @@ class InMemoryCatalog(SqlCatalog):

def __init__(self, name: str, warehouse: str = "file:///tmp/iceberg/warehouse", **kwargs: str) -> None:
self._warehouse_location = warehouse
if "uri" not in kwargs:
kwargs["uri"] = "sqlite:///:memory:"
if URI not in kwargs:
kwargs[URI] = "sqlite:///:memory:"
super().__init__(name=name, warehouse=warehouse, **kwargs)
3 changes: 2 additions & 1 deletion pyiceberg/catalog/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@

from pyiceberg.catalog import (
METADATA_LOCATION,
URI,
Catalog,
MetastoreCatalog,
PropertiesUpdateSummary,
Expand Down Expand Up @@ -119,7 +120,7 @@ class SqlCatalog(MetastoreCatalog):
def __init__(self, name: str, **properties: str):
super().__init__(name, **properties)

if not (uri_prop := self.properties.get("uri")):
if not (uri_prop := self.properties.get(URI)):
raise NoSuchPropertyException("SQL connection URI is required")

echo_str = str(self.properties.get("echo", DEFAULT_ECHO_VALUE)).lower()
Expand Down
4 changes: 2 additions & 2 deletions pyiceberg/cli/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from click import Context

from pyiceberg import __version__
from pyiceberg.catalog import Catalog, load_catalog
from pyiceberg.catalog import URI, Catalog, load_catalog
from pyiceberg.cli.output import ConsoleOutput, JsonOutput, Output
from pyiceberg.exceptions import NoSuchNamespaceError, NoSuchPropertyException, NoSuchTableError
from pyiceberg.table import TableProperties
Expand Down Expand Up @@ -75,7 +75,7 @@ def run(
if ugi:
properties["ugi"] = ugi
if uri:
properties["uri"] = uri
properties[URI] = uri
if credential:
properties["credential"] = credential

Expand Down
4 changes: 2 additions & 2 deletions pyiceberg/io/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from fsspec.implementations.local import LocalFileSystem
from requests import HTTPError

from pyiceberg.catalog import TOKEN
from pyiceberg.catalog import TOKEN, URI
from pyiceberg.exceptions import SignError
from pyiceberg.io import (
ADLS_ACCOUNT_HOST,
Expand Down Expand Up @@ -91,7 +91,7 @@


def s3v4_rest_signer(properties: Properties, request: "AWSRequest", **_: Any) -> "AWSRequest":
signer_url = properties.get(S3_SIGNER_URI, properties["uri"]).rstrip("/") # type: ignore
signer_url = properties.get(S3_SIGNER_URI, properties[URI]).rstrip("/") # type: ignore
signer_endpoint = properties.get(S3_SIGNER_ENDPOINT, S3_SIGNER_ENDPOINT_DEFAULT)

signer_headers = {}
Expand Down