shubham-tomar commented on issue #291:
URL: https://github.com/apache/iceberg-go/issues/291#issuecomment-2660766077

   Hi @zeroshade, i am facing issue while creating table
   
   This is how i am loading catalog
   ```
   config.URI := "http://localhost:19120/iceberg";
   config.WarehouseLocation := "s3://warehouse"
   
   iceCatalog, err := catalog.Load(ctx, catalogName, iceberg.Properties{
                "uri":                  config.URI,
                "warehouse":            config.WarehouseLocation,
                "s3.endpoint":          "http://minio:9000";, // MinIO endpoint
                "s3.access-key-id":     "admin",             // Default MinIO 
access key
                "s3.secret-access-key": "password",          // Default MinIO 
secret key
                "s3.path-style-access": "true",              // Required for 
MinIO
                "s3.region":            "us-east-1",         // Default region
        })
   ```
   Successfully Loaded catalog:  &{0x14000aef710 0x14000b02270 nessieCatalog 
map[prefix:main%7Cs3%3A%2F%2Fwarehouse warehouse:s3://warehouse]}
   Do endpoint:  
http://localhost:19120/iceberg/v1/main%7Cs3%3A%2F%2Fwarehouse/namespaces
   
   i am able to create and List Namespace, 
   - [my_namespace_1]
   
   
   Create Table function
   ```
   func CreateTable(ctx context.Context, iceCatalog *rest.Catalog, ref string, 
tableIdentifier string, schema *iceberg.Schema, opts ...catalog.CreateTableOpt) 
error {
        if schema == nil {
                return fmt.Errorf("schema is required to create a table")
        }
   
        ctx = iceberg.WithRef(ctx, ref)
   
        identifier := catalog.ToIdentifier(tableIdentifier)
   
        defaultOpts := []catalog.CreateTableOpt{
                catalog.WithLocation(fmt.Sprintf("s3://warehouse/%s", 
tableIdentifier)),
                catalog.WithProperties(iceberg.Properties{
                        "format-version":       "2",
                        "write.format.default": "parquet",
                }),
        }
   
        table, err := iceCatalog.CreateTable(ctx, identifier, schema, opts...)
        if err != nil {
                return fmt.Errorf("failed to create table: %w", err)
        }
        return nil
   }
   ```
   
   I have add logs in catalog/rest for debugging and getting this
   
   ```
   DEBUG: Making POST request to: 
http://localhost:19120/iceberg/v1/main%7Cs3%3A%2F%2Fwarehouse/namespaces/my_namespace_1/tables
   DEBUG: Request payload: 
{"name":"iceberg_table_1","schema":{"type":"struct","fields":[{"type":"int","id":1,"name":"id","required":true,"doc":"unique
 identifier"},{"type":"string","id":2,"name":"name","required":true,"doc":"user 
name"},{"type":"timestamp","id":3,"name":"created_at","required":true,"doc":"creation
 
timestamp"}],"schema-id":0,"identifier-field-ids":[]},"location":"s3://warehouse/my_namespace_1.iceberg_table_1","partition-spec":{"spec-id":0,"fields":[]},"write-order":{"order-id":0,"fields":[]},"properties":{"format-version":"2","write.format.default":"parquet"}}
   DEBUG: Request headers: map[Content-Type:[application/json]]
   DEBUG: Response status: 500 Internal Server Error
   DEBUG: Response headers: map[Content-Length:[118] 
Content-Type:[application/json;charset=UTF-8]]
   DEBUG: Response body: {
     "error" : {
       "message" : "HTTP 400 Bad Request",
       "type" : "WebApplicationException",
       "code" : 500
     }
   }
   DEBUG: Error from POST request: WebApplicationException: HTTP 400 Bad Request
   2025/02/15 11:29:16 Failed to create table: failed to create table: 
WebApplicationException: HTTP 400 Bad Request
   ```
   
   Looks like some s3 config is missing but i am not able to figure out what 
exactly is missing, let me know 
   
   My nessie and minio configs
   
   ```
   nessie:
       image: ghcr.io/projectnessie/nessie:0.102.5-java
       container_name: nessie
       depends_on:
         - minio
       environment:
         - QUARKUS_PROFILE=iceberg
         - NESSIE_ICEBERG_REST_API_ENABLED=true
         - NESSIE_CATALOG_ICEBERG_DEFAULT_WAREHOUSE=s3://warehouse/
         - NESSIE_CATALOG_DEFAULT_WAREHOUSE=warehouse
         - NESSIE_CATALOG_WAREHOUSES_WAREHOUSE_LOCATION=s3://warehouse/
         - AWS_REGION=us-east-1
         - AWS_ACCESS_KEY_ID=admin
         - AWS_SECRET_ACCESS_KEY=password
         - NESSIE_OBJECT_STORAGE_ACCESS_KEY=admin
         - NESSIE_OBJECT_STORAGE_SECRET_KEY=password 
         - AWS_ENDPOINT=http://minio:9000
         - NESSIE_OBJECT_STORAGE_AUTH_MODE=STATIC
         # # Default/global S3 configuration settings
         - 
NESSIE_CATALOG_SERVICE_S3_DEFAULT_OPTIONS_ACCESS_KEY=urn:nessie-secret:quarkus:my-secrets-default
         - MY_SECRETS_DEFAULT_NAME=admin
         - MY_SECRETS_DEFAULT_SECRET=password
       networks:
         iceberg:
       ports:
         - 19120:19120
     # Minio Storage Server
     minio:
       image: minio/minio:latest
       container_name: minio
       environment:
         - MINIO_ROOT_USER=admin
         - MINIO_ROOT_PASSWORD=password
         - MINIO_DOMAIN=storage
         - MINIO_REGION_NAME=us-east-1
         - MINIO_REGION=us-east-1
       networks:
         iceberg:
       ports:
         - 9001:9001
         - 9000:9000
       command: ["server", "/data", "--console-address", ":9001"]
   ```
   


-- 
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-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to