Skip to content

Commit

Permalink
Version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
efrotenberg committed Feb 4, 2024
1 parent 5f7dbe8 commit 9d6c34a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,13 @@ It presents a side-by-side comparison of current metrics against potential impro
## Installation
`iceberg-diag` can be installed using either Brew or PIP, as detailed below:

### Using Brew
Execute the following commands to install `iceberg-diag` via Brew:

```bash
brew tap upsolver/iceberg-diag
brew install iceberg-diag
```

### Using PIP
#### Prerequisites

* **Python 3.8 or higher**: Verify Python's installation:
```bash
python3 --version
```
* **Rust**: check if installed:
```bash
cargo --version
```
If Rust is not installed, install it using:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```
To install `iceberg-diag` using PIP, ensure you have the latest version of `pip`:

```bash
Expand All @@ -43,6 +26,16 @@ Then, install the package with `pip`
pip install iceberg-diag
```


### Using Brew
Execute the following commands to install `iceberg-diag` via Brew:

```bash
brew tap upsolver/iceberg-diag
brew install iceberg-diag
```


## Usage Instructions

```bash
Expand Down
6 changes: 3 additions & 3 deletions icebergdiag/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ def display_list(lst: List[str], heading: str) -> None:


def list_tables(diagnostics_manager: IcebergDiagnosticsManager, database: str) -> None:
tables = diagnostics_manager.list_tables(database)
tables = run_with_progress(diagnostics_manager.list_tables, "Fetching Iceberg tables...", database)
display_list(tables, "Tables")
error_message = (
"Use --table-name to get diagnostics on the iceberg table, "
"Use --table-name to get diagnostics on the Iceberg table, "
"you can use a glob pattern to receive diagnostics on multiple tables in one command"
)
stderr_print(error_message)


def list_databases(diagnostics_manager: IcebergDiagnosticsManager) -> None:
databases = diagnostics_manager.list_databases()
databases = run_with_progress(diagnostics_manager.list_databases, "Fetching databases...")
display_list(databases, "Databases")
stderr_print("Use --database to get the list of tables")

Expand Down
5 changes: 4 additions & 1 deletion icebergdiag/diagnostics/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from pyiceberg.utils.concurrent import ExecutorFactory

from icebergdiag.exceptions import ProfileNotFoundError, EndpointConnectionError, \
IcebergDiagnosticsError, DatabaseNotFound, TableMetricsCalculationError, SSOAuthenticationError
IcebergDiagnosticsError, DatabaseNotFound, TableMetricsCalculationError, SSOAuthenticationError, \
SessionInitializationError
from icebergdiag.metrics.table import Table
from icebergdiag.metrics.table_metrics import TableMetrics, MetricsCalculator

Expand All @@ -40,6 +41,8 @@ def _initialize_catalog(self):
raise EndpointConnectionError(self.region)
except boto3_exceptions.SSOError as e:
raise SSOAuthenticationError(self.profile, e) from e
except boto3_exceptions.BotoCoreError as e:
raise SessionInitializationError(self.profile, e)
except Exception as e:
raise IcebergDiagnosticsError(f"An unexpected error occurred: {e}")

Expand Down
18 changes: 14 additions & 4 deletions icebergdiag/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ def __init__(self, message: str = "An error occurred in Iceberg Diagnostics Mana
class ProfileNotFoundError(IcebergDiagnosticsError):
"""Exception raised when the specified AWS profile does not exist."""

def __init__(self, profile: str):
super().__init__(f"The AWS profile '{profile}' does not exist.")
def __init__(self, profile: Optional[str]):
profile_msg = f"The AWS profile '{profile}' does not exist." if profile is not None else "No AWS profile found."
super().__init__(profile_msg)


class SSOAuthenticationError(IcebergDiagnosticsError):
Expand All @@ -38,8 +39,17 @@ def __init__(self):
class EndpointConnectionError(IcebergDiagnosticsError):
"""Exception raised when connection to AWS endpoint fails."""

def __init__(self, region: str):
super().__init__(f"Could not connect to AWS in the region '{region}'.")
def __init__(self, region: Optional[str]):
region_message = f"region '{region}'" if region is not None else "default region"
super().__init__(f"Could not connect to AWS in the {region_message}.")


class SessionInitializationError(IcebergDiagnosticsError):
"""Exception raised when an AWS session fails to initialize."""
def __init__(self, profile: Optional[str], original_error: Exception):
profile_part = f"with profile '{profile}'" if profile else "with default profile"
message = f"Failed to initialize AWS session {profile_part}: {original_error}"
super().__init__(message)


class UnexpectedError(IcebergDiagnosticsError):
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[tool.poetry]
name = "iceberg-diag"
version = "0.1.0"
version = "0.1.1"
description = "Upsolver Iceberg Auditor CLI"
authors = ["Upsolver <[email protected]>"]
license = "MIT"
readme = "README.md"
homepage = "https://github.com/Upsolver/iceberg-diag"


packages = [
{include = "icebergdiag"},
Expand Down

0 comments on commit 9d6c34a

Please sign in to comment.