Skip to content

Commit 9f56bb2

Browse files
committed
[DOP-28169] MySQL database name is optional
1 parent 8823250 commit 9f56bb2

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

syncmaster/dto/connections.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2023-2024 MTS PJSC
22
# SPDX-License-Identifier: Apache-2.0
3-
from dataclasses import dataclass
3+
from dataclasses import dataclass, field
44
from typing import ClassVar, Literal
55

66

@@ -15,8 +15,8 @@ class PostgresConnectionDTO(ConnectionDTO):
1515
port: int
1616
user: str
1717
password: str
18-
additional_params: dict
1918
database_name: str
19+
additional_params: dict = field(default_factory=dict)
2020
type: ClassVar[str] = "postgres"
2121

2222

@@ -26,8 +26,8 @@ class ClickhouseConnectionDTO(ConnectionDTO):
2626
port: int
2727
user: str
2828
password: str
29-
database_name: str
30-
additional_params: dict
29+
database_name: str | None = None
30+
additional_params: dict = field(default_factory=dict)
3131
type: ClassVar[str] = "clickhouse"
3232

3333

@@ -38,7 +38,7 @@ class MSSQLConnectionDTO(ConnectionDTO):
3838
user: str
3939
password: str
4040
database_name: str
41-
additional_params: dict
41+
additional_params: dict = field(default_factory=dict)
4242
type: ClassVar[str] = "mssql"
4343

4444

@@ -48,8 +48,8 @@ class MySQLConnectionDTO(ConnectionDTO):
4848
port: int
4949
user: str
5050
password: str
51-
database_name: str
52-
additional_params: dict
51+
database_name: str | None = None
52+
additional_params: dict = field(default_factory=dict)
5353
type: ClassVar[str] = "mysql"
5454

5555

@@ -59,7 +59,7 @@ class OracleConnectionDTO(ConnectionDTO):
5959
port: int
6060
user: str
6161
password: str
62-
additional_params: dict
62+
additional_params: dict = field(default_factory=dict)
6363
sid: str | None = None
6464
service_name: str | None = None
6565
type: ClassVar[str] = "oracle"
@@ -91,7 +91,7 @@ class IcebergRESTCatalogS3DirectConnectionBaseDTO(IcebergConnectionBaseDTO):
9191
s3_secret_key: str
9292
s3_port: int | None
9393
s3_protocol: str
94-
s3_additional_params: dict
94+
s3_additional_params: dict = field(default_factory=dict)
9595
implementation: ClassVar[str] = "iceberg_rest_s3_direct"
9696

9797

@@ -175,7 +175,7 @@ class S3ConnectionDTO(ConnectionDTO):
175175
secret_key: str
176176
bucket: str
177177
bucket_style: Literal["domain", "path"]
178-
additional_params: dict
178+
additional_params: dict = field(default_factory=dict)
179179
region: str | None = None
180180
protocol: str = "https"
181181
type: ClassVar[str] = "s3"
@@ -212,9 +212,9 @@ class FTPSConnectionDTO(ConnectionDTO):
212212
class SambaConnectionDTO(ConnectionDTO):
213213
host: str
214214
share: str
215-
protocol: Literal["SMB", "NetBIOS"]
216215
user: str
217216
password: str
217+
protocol: Literal["SMB", "NetBIOS"] = "SMB"
218218
auth_type: Literal["NTLMv1", "NTLMv2"] = "NTLMv2"
219219
domain: str = ""
220220
port: int | None = None

syncmaster/schemas/v1/connections/mysql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class MySQLConnectionDataSchema(BaseModel):
1818
host: str
1919
port: int = Field(default=3306, gt=0, le=65535) # noqa: WPS432
20-
database_name: str
20+
database_name: str | None = None
2121
additional_params: dict = Field(default_factory=dict)
2222

2323

syncmaster/schemas/v1/transfers/resources.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,13 @@
22
# SPDX-License-Identifier: Apache-2.0
33
from pydantic import BaseModel, ByteSize, Field
44

5-
ONE_MB = 2**20 # noqa: WPS432
6-
ONE_GB = 2**30 # noqa: WPS432
7-
85

96
class Resources(BaseModel):
107
max_parallel_tasks: int = Field(default=1, ge=1, le=100, description="Parallel executors")
118
cpu_cores_per_task: int = Field(default=1, ge=1, le=32, description="Cores per executor") # noqa: WPS432
129
ram_bytes_per_task: ByteSize = Field( # type: ignore[arg-type]
13-
default=ONE_GB,
14-
ge=512 * ONE_MB, # noqa: WPS432
15-
le=64 * ONE_GB, # noqa: WPS432
10+
default="1GiB",
11+
ge="512MiB", # noqa: WPS432
12+
le="64GiB", # noqa: WPS432
1613
description="RAM per executor",
1714
)

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class TestSettings(BaseSettings):
5050
TEST_MYSQL_PORT_FOR_WORKER: int
5151
TEST_MYSQL_USER: str
5252
TEST_MYSQL_PASSWORD: str
53-
TEST_MYSQL_DB: str
53+
TEST_MYSQL_DB: str | None = None
5454
TEST_MYSQL_ADDITIONAL_PARAMS: dict = {}
5555

5656
TEST_HIVE_CLUSTER: str

0 commit comments

Comments
 (0)