Skip to content

Commit 74e346b

Browse files
committed
Sync S3 and IcebergRestS3 bucket_style option
1 parent 7c1fd1e commit 74e346b

File tree

10 files changed

+18
-16
lines changed

10 files changed

+18
-16
lines changed

.env.docker.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ TEST_ICEBERG_METASTORE_USERNAME=syncmaster
5757
TEST_ICEBERG_METASTORE_PASSWORD=123UsedForTestOnly@!
5858
TEST_ICEBERG_S3_WAREHOUSE_PATH=/data
5959
TEST_ICEBERG_S3_REGION=us-east-1
60-
TEST_ICEBERG_S3_PATH_STYLE_ACCESS=True
60+
TEST_ICEBERG_S3_BUCKET_STYLE=path
6161

6262
TEST_HDFS_HOST=test-hive
6363
TEST_HDFS_WEBHDFS_PORT=9870

.env.local.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export TEST_ICEBERG_METASTORE_USERNAME=syncmaster
5757
export TEST_ICEBERG_METASTORE_PASSWORD=123UsedForTestOnly@!
5858
export TEST_ICEBERG_S3_WAREHOUSE_PATH=/data
5959
export TEST_ICEBERG_S3_REGION=us-east-1
60-
export TEST_ICEBERG_S3_PATH_STYLE_ACCESS=True
60+
export TEST_ICEBERG_S3_BUCKET_STYLE=path
6161

6262
export TEST_HDFS_HOST=test-hive
6363
export TEST_HDFS_WEBHDFS_PORT=9870

syncmaster/dto/connections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ class IcebergRESTCatalogS3ConnectionDTO(ConnectionDTO):
7979
s3_warehouse_path: str
8080
s3_host: str
8181
s3_bucket: str
82+
s3_bucket_style: str
8283
s3_region: str
8384
s3_access_key: str
8485
s3_secret_key: str
8586
metastore_username: str
8687
metastore_password: str
8788
s3_port: int | None = None
8889
s3_protocol: str = "https"
89-
s3_path_style_access: bool = False
9090
type: ClassVar[str] = "iceberg_rest_s3"
9191

9292

@@ -105,6 +105,7 @@ class S3ConnectionDTO(ConnectionDTO):
105105
access_key: str
106106
secret_key: str
107107
bucket: str
108+
bucket_style: str
108109
additional_params: dict
109110
region: str | None = None
110111
protocol: str = "https"

syncmaster/schemas/v1/connections/iceberg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CreateIcebergRESTCatalogS3ConnectionDataSchema(BaseModel):
2525
s3_protocol: Literal["http", "https"] = "https"
2626
s3_bucket: str
2727
s3_region: str
28-
s3_path_style_access: bool = False
28+
s3_bucket_style: Literal["domain", "path"] = "path"
2929

3030

3131
class ReadIcebergRESTCatalogS3ConnectionDataSchema(BaseModel):
@@ -36,7 +36,7 @@ class ReadIcebergRESTCatalogS3ConnectionDataSchema(BaseModel):
3636
s3_protocol: Literal["http", "https"] = "https"
3737
s3_bucket: str
3838
s3_region: str
39-
s3_path_style_access: bool = False
39+
s3_bucket_style: Literal["domain", "path"] = "path"
4040

4141

4242
class CreateIcebergConnectionSchema(CreateConnectionBaseSchema):

syncmaster/worker/handlers/db/iceberg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def connect(self, spark: SparkSession):
4444
port=self.connection_dto.s3_port,
4545
protocol=self.connection_dto.s3_protocol,
4646
bucket=self.connection_dto.s3_bucket,
47-
path_style_access=self.connection_dto.s3_path_style_access,
47+
path_style_access=self.connection_dto.s3_bucket_style == "path",
4848
region=self.connection_dto.s3_region,
4949
access_key=self.connection_dto.s3_access_key,
5050
secret_key=self.connection_dto.s3_secret_key,
@@ -53,7 +53,7 @@ def connect(self, spark: SparkSession):
5353

5454
@slot
5555
def read(self) -> DataFrame:
56-
table = f"{self.transfer_dto.catalog_name}.{self.transfer_dto.table_name}"
56+
table = ".".join([self.transfer_dto.catalog_name, self.transfer_dto.table_name])
5757
self.connection.spark.catalog.refreshTable(table)
5858
return super().read()
5959

syncmaster/worker/handlers/file/s3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def connect(self, spark: SparkSession):
2828
access_key=self.connection_dto.access_key,
2929
secret_key=self.connection_dto.secret_key,
3030
bucket=self.connection_dto.bucket,
31+
path_style_access=self.connection_dto.bucket_style == "path",
3132
protocol=self.connection_dto.protocol,
3233
region=self.connection_dto.region,
3334
extra=self.connection_dto.additional_params,

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class TestSettings(BaseSettings):
5656
TEST_ICEBERG_METASTORE_PASSWORD: str
5757
TEST_ICEBERG_S3_WAREHOUSE_PATH: str
5858
TEST_ICEBERG_S3_REGION: str
59-
TEST_ICEBERG_S3_PATH_STYLE_ACCESS: bool = True
59+
TEST_ICEBERG_S3_BUCKET_STYLE: bool = True
6060

6161
TEST_HDFS_HOST: str
6262
TEST_HDFS_WEBHDFS_PORT: int

tests/test_integration/test_run_transfer/connection_fixtures/iceberg_fixtures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def iceberg_rest_s3_for_conftest(test_settings: TestSettings) -> IcebergRESTCata
3030
s3_protocol=test_settings.TEST_S3_PROTOCOL,
3131
s3_bucket=test_settings.TEST_S3_BUCKET,
3232
s3_region=test_settings.TEST_ICEBERG_S3_REGION,
33-
s3_path_style_access=test_settings.TEST_ICEBERG_S3_PATH_STYLE_ACCESS,
33+
s3_bucket_style=test_settings.TEST_ICEBERG_S3_BUCKET_STYLE,
3434
s3_access_key=test_settings.TEST_S3_ACCESS_KEY,
3535
s3_secret_key=test_settings.TEST_S3_SECRET_KEY,
3636
metastore_username=test_settings.TEST_ICEBERG_METASTORE_USERNAME,
@@ -51,7 +51,7 @@ def iceberg_rest_s3_for_worker(test_settings: TestSettings) -> IcebergRESTCatalo
5151
s3_protocol=test_settings.TEST_S3_PROTOCOL,
5252
s3_bucket=test_settings.TEST_S3_BUCKET,
5353
s3_region=test_settings.TEST_ICEBERG_S3_REGION,
54-
s3_path_style_access=test_settings.TEST_ICEBERG_S3_PATH_STYLE_ACCESS,
54+
s3_bucket_style=test_settings.TEST_ICEBERG_S3_BUCKET_STYLE,
5555
s3_access_key=test_settings.TEST_S3_ACCESS_KEY,
5656
s3_secret_key=test_settings.TEST_S3_SECRET_KEY,
5757
metastore_username=test_settings.TEST_ICEBERG_METASTORE_USERNAME,
@@ -87,7 +87,7 @@ def prepare_iceberg_rest_s3(
8787
port=iceberg.s3_port,
8888
protocol=iceberg.s3_protocol,
8989
bucket=iceberg.s3_bucket,
90-
path_style_access=iceberg.s3_path_style_access,
90+
path_style_access=iceberg.s3_bucket_style == "path",
9191
region=iceberg.s3_region,
9292
access_key=iceberg.s3_access_key,
9393
secret_key=iceberg.s3_secret_key,
@@ -134,7 +134,7 @@ async def iceberg_rest_s3_connection(
134134
s3_protocol=iceberg.s3_protocol,
135135
s3_bucket=iceberg.s3_bucket,
136136
s3_region=iceberg.s3_region,
137-
s3_path_style_access=iceberg.s3_path_style_access,
137+
s3_bucket_style=iceberg.s3_bucket_style,
138138
),
139139
group_id=group.id,
140140
)

tests/test_unit/test_connections/test_db_connection/test_create_iceberg_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ async def test_developer_plus_can_create_iceberg_rest_s3_connection(
3636
"s3_port": 9010,
3737
"s3_bucket": "some_bucket",
3838
"s3_region": "us-east-1",
39-
"s3_path_style_access": True,
39+
"s3_bucket_style": True,
4040
},
4141
"auth_data": {
4242
"type": "iceberg_rest_basic_s3_basic",
@@ -79,7 +79,7 @@ async def test_developer_plus_can_create_iceberg_rest_s3_connection(
7979
"s3_port": connection.data["s3_port"],
8080
"s3_bucket": connection.data["s3_bucket"],
8181
"s3_region": connection.data["s3_region"],
82-
"s3_path_style_access": connection.data["s3_path_style_access"],
82+
"s3_bucket_style": connection.data["s3_bucket_style"],
8383
},
8484
"auth_data": {
8585
"type": decrypted["type"],

tests/test_unit/test_connections/test_db_connection/test_update_iceberg_connection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"s3_port": 9010,
2121
"s3_bucket": "some_bucket",
2222
"s3_region": "us-east-1",
23-
"s3_path_style_access": True,
23+
"s3_bucket_style": True,
2424
},
2525
{
2626
"type": "iceberg_rest_basic_s3_basic",
@@ -79,7 +79,7 @@ async def test_developer_plus_can_update_iceberg_rest_s3_connection(
7979
"s3_port": None,
8080
"s3_bucket": "new_bucket",
8181
"s3_region": "us-east-2",
82-
"s3_path_style_access": False,
82+
"s3_bucket_style": False,
8383
},
8484
"auth_data": {
8585
"type": group_connection.credentials.value["type"],

0 commit comments

Comments
 (0)