apache / iceberg-go

Apache Iceberg - Go
https://iceberg.apache.org/
Apache License 2.0
142 stars 34 forks source link

feat(catalog/glue): add support for glue catalog namespace operations #173

Closed natusioe closed 4 weeks ago

natusioe commented 1 month ago

Continuation from the previous PR to support Glue catalog. Add support for more namespace and table operations. In the next PR, remaining operations will be added to complete Glue catalog for tables (e.g. create table).

I mostly followed the same semantics as the pyiceberg Glue catalog for the implementation. This means that Glue database fields (description and location URI) are stored as props. Error handling are also done in a similar way.

Testing

Updated cmd/iceberg/main.go and manually tested using my personal AWS account:

> go run ./cmd/iceberg create --catalog glue --description "my new catalog" --location-uri "s3://test-namespace/" namespace apache-iceberg-test-00006

> go run ./cmd/iceberg describe --catalog glue namespace apache-iceberg-test-00006
┌──────────────────────────────────────┐
| Key           | Value                |
| ------------------------------------ |
| database_type | ICEBERG              |
| Description   | my new catalog       |
| Location      | s3://test-namespace/ |
└──────────────────────────────────────┘

> go run ./cmd/iceberg list --catalog glue
┌───────────────────────────┐
| IDs                       |
| ------------------------- |
| apache-iceberg-test-00001 |
| apache-iceberg-test-00002 |
| apache-iceberg-test-00003 |
| apache-iceberg-test-00004 |
| apache-iceberg-test-00005 |
| apache-iceberg-test-00006 |
└───────────────────────────┘

> go run ./cmd/iceberg properties --catalog glue get namespace apache-iceberg-test-00006 Description
my new catalog

> go run ./cmd/iceberg properties --catalog glue set namespace apache-iceberg-test-00006 Description "updated description"
updated Description on apache-iceberg-test-00006

> go run ./cmd/iceberg properties --catalog glue get namespace apache-iceberg-test-00006 Description
updated description

> go run ./cmd/iceberg describe --catalog glue namespace apache-iceberg-test-00006
┌──────────────────────────────────────┐
| Key           | Value                |
| ------------------------------------ |
| Description   | updated description  |
| Location      | s3://test-namespace/ |
| database_type | ICEBERG              |
└──────────────────────────────────────┘