-
Notifications
You must be signed in to change notification settings - Fork 163
Expand file tree
/
Copy pathpostgres_slot_config.py
More file actions
60 lines (41 loc) · 1.56 KB
/
postgres_slot_config.py
File metadata and controls
60 lines (41 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from dataclasses import dataclass
from typing import TYPE_CHECKING, TypedDict
from databricks.bundles.core._transform import _transform
from databricks.bundles.core._transform_to_json import _transform_to_json_value
from databricks.bundles.core._variable import VariableOrOptional
if TYPE_CHECKING:
from typing_extensions import Self
@dataclass(kw_only=True)
class PostgresSlotConfig:
"""
:meta private: [EXPERIMENTAL]
PostgresSlotConfig contains the configuration for a Postgres logical replication slot
"""
publication_name: VariableOrOptional[str] = None
"""
:meta private: [EXPERIMENTAL]
The name of the publication to use for the Postgres source
"""
slot_name: VariableOrOptional[str] = None
"""
:meta private: [EXPERIMENTAL]
The name of the logical replication slot to use for the Postgres source
"""
@classmethod
def from_dict(cls, value: "PostgresSlotConfigDict") -> "Self":
return _transform(cls, value)
def as_dict(self) -> "PostgresSlotConfigDict":
return _transform_to_json_value(self) # type:ignore
class PostgresSlotConfigDict(TypedDict, total=False):
""""""
publication_name: VariableOrOptional[str]
"""
:meta private: [EXPERIMENTAL]
The name of the publication to use for the Postgres source
"""
slot_name: VariableOrOptional[str]
"""
:meta private: [EXPERIMENTAL]
The name of the logical replication slot to use for the Postgres source
"""
PostgresSlotConfigParam = PostgresSlotConfigDict | PostgresSlotConfig