Skip to content

Commit 24978a8

Browse files
committed
[DOP-30631] Improve naming of Iceberg connection params
1 parent 86e6167 commit 24978a8

File tree

16 files changed

+117
-117
lines changed

16 files changed

+117
-117
lines changed

.env.docker.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ TEST_HIVE_CLUSTER=test-hive
5252
TEST_HIVE_USER=syncmaster
5353
TEST_HIVE_PASSWORD=123UsedForTestOnly@!
5454

55-
TEST_ICEBERG_METASTORE_URL_FOR_CONFTEST=http://test-iceberg-rest:8181
56-
TEST_ICEBERG_METASTORE_URL_FOR_WORKER=http://test-iceberg-rest:8181
57-
TEST_ICEBERG_METASTORE_USERNAME=syncmaster
58-
TEST_ICEBERG_METASTORE_PASSWORD=123UsedForTestOnly@!
55+
TEST_ICEBERG_REST_CATALOG_URL_FOR_CONFTEST=http://test-iceberg-rest:8181
56+
TEST_ICEBERG_REST_CATALOG_URL_FOR_WORKER=http://test-iceberg-rest:8181
57+
TEST_ICEBERG_REST_CATALOG_USERNAME=syncmaster
58+
TEST_ICEBERG_REST_CATALOG_PASSWORD=123UsedForTestOnly@!
5959
TEST_ICEBERG_S3_WAREHOUSE_PATH=/data
6060
TEST_ICEBERG_S3_REGION=us-east-1
6161
TEST_ICEBERG_S3_BUCKET_STYLE=path

.env.local.test

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ export TEST_HIVE_CLUSTER=test-hive
5252
export TEST_HIVE_USER=syncmaster
5353
export TEST_HIVE_PASSWORD=123UsedForTestOnly@!
5454

55-
export TEST_ICEBERG_METASTORE_URL_FOR_CONFTEST=http://localhost:8181
56-
export TEST_ICEBERG_METASTORE_URL_FOR_WORKER=http://test-iceberg-rest:8181
57-
export TEST_ICEBERG_METASTORE_USERNAME=syncmaster
58-
export TEST_ICEBERG_METASTORE_PASSWORD=123UsedForTestOnly@!
55+
export TEST_ICEBERG_REST_CATALOG_URL_FOR_CONFTEST=http://localhost:8181
56+
export TEST_ICEBERG_REST_CATALOG_URL_FOR_WORKER=http://test-iceberg-rest:8181
57+
export TEST_ICEBERG_REST_CATALOG_USERNAME=syncmaster
58+
export TEST_ICEBERG_REST_CATALOG_PASSWORD=123UsedForTestOnly@!
5959
export TEST_ICEBERG_S3_WAREHOUSE_PATH=/data
6060
export TEST_ICEBERG_S3_REGION=us-east-1
6161
export TEST_ICEBERG_S3_BUCKET_STYLE=path

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ cython_debug/
155155
.idea/
156156
.vscode/
157157

158-
**/metastore_db/
158+
**/rest_catalog_db/
159159
**/spark-warehouse/
160160
cached_jars/
161161

docker-compose.test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ services:
331331
environment:
332332
TZ: UTC
333333
WITH_HIVE_SERVER: 'false' # We leave only the metastore server, we don’t need Hive itself, we don’t waste resources on it
334-
HIVE_METASTORE_DB_URL: jdbc:postgresql://metastore-hive:5432/metastore
335-
HIVE_METASTORE_DB_DRIVER: org.postgresql.Driver
336-
HIVE_METASTORE_DB_USER: test_hive
337-
HIVE_METASTORE_DB_PASSWORD: test_hive
334+
HIVE_REST_CATALOG_DB_URL: jdbc:postgresql://metastore-hive:5432/metastore
335+
HIVE_REST_CATALOG_DB_DRIVER: org.postgresql.Driver
336+
HIVE_REST_CATALOG_DB_USER: test_hive
337+
HIVE_REST_CATALOG_DB_PASSWORD: test_hive
338338
# writing spark dataframe to s3, sftp, ftp, ftps xml file fails without running hive metastore server
339339
profiles: [hive, hdfs, s3, sftp, ftp, ftps, samba, webdav, all]
340340

syncmaster/dto/connections.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class HiveConnectionDTO(ConnectionDTO):
7575

7676
@dataclass
7777
class IcebergRESTCatalogS3ConnectionBaseDTO(ConnectionDTO):
78-
metastore_url: str
78+
rest_catalog_url: str
7979
s3_warehouse_path: str
8080
s3_host: str
8181
s3_bucket: str
@@ -91,26 +91,26 @@ class IcebergRESTCatalogS3ConnectionBaseDTO(ConnectionDTO):
9191

9292
@dataclass(kw_only=True)
9393
class IcebergRESTCatalogBasicAuthS3DTO(IcebergRESTCatalogS3ConnectionBaseDTO):
94-
metastore_username: str
95-
metastore_password: str
96-
metastore_auth_type: Literal["basic"] = "basic"
94+
rest_catalog_username: str
95+
rest_catalog_password: str
96+
rest_catalog_auth_type: Literal["basic"] = "basic"
9797

9898

9999
@dataclass(kw_only=True)
100100
class IcebergRESTCatalogOAuth2ClientCredentialsS3DTO(IcebergRESTCatalogS3ConnectionBaseDTO):
101-
metastore_oauth2_client_id: str
102-
metastore_oauth2_client_secret: str
103-
metastore_oauth2_scopes: list[str]
104-
metastore_oauth2_resource: str | None = None
105-
metastore_oauth2_audience: str | None = None
106-
metastore_oauth2_server_uri: str | None = None
107-
metastore_auth_type: Literal["oauth2"] = "oauth2"
101+
rest_catalog_oauth2_client_id: str
102+
rest_catalog_oauth2_client_secret: str
103+
rest_catalog_oauth2_scopes: list[str]
104+
rest_catalog_oauth2_resource: str | None = None
105+
rest_catalog_oauth2_audience: str | None = None
106+
rest_catalog_oauth2_server_uri: str | None = None
107+
rest_catalog_auth_type: Literal["oauth2"] = "oauth2"
108108

109109

110110
# TODO: should be refactored
111111
class IcebergRESTCatalogS3ConnectionDTO:
112112
def __new__(cls, **data):
113-
if "metastore_oauth2_client_id" in data:
113+
if "rest_catalog_oauth2_client_id" in data:
114114
return IcebergRESTCatalogOAuth2ClientCredentialsS3DTO(**data)
115115

116116
return IcebergRESTCatalogBasicAuthS3DTO(**data)

syncmaster/schemas/v1/auth/iceberg/basic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
class ReadIcebergRESTCatalogBasicAuthSchema(BaseModel):
99
type: Literal["iceberg_rest_basic_s3_basic"] = Field(description="Auth type")
10-
metastore_username: str
10+
rest_catalog_username: str
1111
s3_access_key: str
1212

1313

1414
class CreateIcebergRESTCatalogBasicAuthSchema(ReadIcebergRESTCatalogBasicAuthSchema):
15-
metastore_password: SecretStr
15+
rest_catalog_password: SecretStr
1616
s3_secret_key: SecretStr
1717

1818

1919
class UpdateIcebergRESTCatalogBasicAuthSchema(ReadIcebergRESTCatalogBasicAuthSchema):
20-
metastore_password: SecretStr | None = None
20+
rest_catalog_password: SecretStr | None = None
2121
s3_secret_key: SecretStr | None = None
2222

2323
def get_secret_fields(self) -> tuple[str, ...]:
24-
return ("metastore_password", "s3_secret_key")
24+
return ("rest_catalog_password", "s3_secret_key")

syncmaster/schemas/v1/auth/iceberg/oauth2_client_credentials.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@
99

1010
class ReadIcebergRESTCatalogOAuth2ClientCredentialsAuthSchema(BaseModel):
1111
type: Literal["iceberg_rest_oauth2_client_credentials_s3_basic"] = Field(description="Auth type")
12-
metastore_oauth2_client_id: str
13-
metastore_oauth2_scopes: list[str] = Field(default_factory=list)
14-
metastore_oauth2_resource: str | None = None
15-
metastore_oauth2_audience: str | None = None
16-
metastore_oauth2_server_uri: URL | None = None
12+
rest_catalog_oauth2_client_id: str
13+
rest_catalog_oauth2_scopes: list[str] = Field(default_factory=list)
14+
rest_catalog_oauth2_resource: str | None = None
15+
rest_catalog_oauth2_audience: str | None = None
16+
rest_catalog_oauth2_server_uri: URL | None = None
1717
s3_access_key: str
1818

1919

2020
class CreateIcebergRESTCatalogOAuth2ClientCredentialsAuthSchema(
2121
ReadIcebergRESTCatalogOAuth2ClientCredentialsAuthSchema,
2222
):
23-
metastore_oauth2_client_secret: SecretStr
23+
rest_catalog_oauth2_client_secret: SecretStr
2424
s3_secret_key: SecretStr
2525

2626

2727
class UpdateIcebergRESTCatalogOAuth2ClientCredentialsAuthSchema(
2828
ReadIcebergRESTCatalogOAuth2ClientCredentialsAuthSchema,
2929
):
30-
metastore_oauth2_client_secret: SecretStr | None = None
30+
rest_catalog_oauth2_client_secret: SecretStr | None = None
3131
s3_secret_key: SecretStr | None = None
3232

3333
def get_secret_fields(self) -> tuple[str, ...]:
34-
return ("metastore_oauth2_client_secret", "s3_secret_key")
34+
return ("rest_catalog_oauth2_client_secret", "s3_secret_key")

syncmaster/schemas/v1/connections/iceberg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
class IcebergRESTCatalogS3ConnectionDataSchema(BaseModel):
22-
metastore_url: URL
22+
rest_catalog_url: URL
2323
s3_warehouse_path: str
2424
s3_host: str
2525
s3_port: int | None = Field(default=None, gt=0, le=65535) # noqa: WPS432

syncmaster/worker/handlers/db/iceberg.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def connect(self, spark: SparkSession):
3232
spark=spark,
3333
catalog_name=self.transfer_dto.catalog_name,
3434
catalog=Iceberg.RESTCatalog(
35-
uri=self.connection_dto.metastore_url,
35+
uri=self.connection_dto.rest_catalog_url,
3636
auth=self._make_auth(),
3737
),
3838
warehouse=Iceberg.S3Warehouse(
@@ -90,16 +90,16 @@ def _quote_field(self, field: str) -> str:
9090
return f"`{field}`"
9191

9292
def _make_auth(self):
93-
if self.connection_dto.metastore_auth_type == "oauth2":
93+
if self.connection_dto.rest_catalog_auth_type == "oauth2":
9494
return Iceberg.RESTCatalog.OAuth2ClientCredentials(
95-
client_id=self.connection_dto.metastore_oauth2_client_id,
96-
client_secret=self.connection_dto.metastore_oauth2_client_secret,
97-
scopes=self.connection_dto.metastore_oauth2_scopes,
98-
resource=self.connection_dto.metastore_oauth2_resource,
99-
audience=self.connection_dto.metastore_oauth2_audience,
100-
server_uri=self.connection_dto.metastore_oauth2_server_uri,
95+
client_id=self.connection_dto.rest_catalog_oauth2_client_id,
96+
client_secret=self.connection_dto.rest_catalog_oauth2_client_secret,
97+
scopes=self.connection_dto.rest_catalog_oauth2_scopes,
98+
resource=self.connection_dto.rest_catalog_oauth2_resource,
99+
audience=self.connection_dto.rest_catalog_oauth2_audience,
100+
server_uri=self.connection_dto.rest_catalog_oauth2_server_uri,
101101
)
102102
return Iceberg.RESTCatalog.BasicAuth(
103-
user=self.connection_dto.metastore_username,
104-
password=self.connection_dto.metastore_password,
103+
user=self.connection_dto.rest_catalog_username,
104+
password=self.connection_dto.rest_catalog_password,
105105
)

tests/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ class TestSettings(BaseSettings):
5757
TEST_HIVE_USER: str
5858
TEST_HIVE_PASSWORD: str
5959

60-
TEST_ICEBERG_METASTORE_URL_FOR_CONFTEST: str
61-
TEST_ICEBERG_METASTORE_URL_FOR_WORKER: str
62-
TEST_ICEBERG_METASTORE_USERNAME: str
63-
TEST_ICEBERG_METASTORE_PASSWORD: str
60+
TEST_ICEBERG_REST_CATALOG_URL_FOR_CONFTEST: str
61+
TEST_ICEBERG_REST_CATALOG_URL_FOR_WORKER: str
62+
TEST_ICEBERG_REST_CATALOG_USERNAME: str
63+
TEST_ICEBERG_REST_CATALOG_PASSWORD: str
6464
TEST_ICEBERG_S3_WAREHOUSE_PATH: str
6565
TEST_ICEBERG_S3_REGION: str
6666
TEST_ICEBERG_S3_BUCKET_STYLE: Literal["domain", "path"] = "path"

0 commit comments

Comments
 (0)