ry-pg-utils 1.0.8__tar.gz → 1.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ry_pg_utils-1.0.8/src/ry_pg_utils.egg-info → ry_pg_utils-1.0.10}/PKG-INFO +1 -1
- ry_pg_utils-1.0.10/VERSION +1 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/ipc/channels.py +1 -2
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/pb_types/database_pb2.py +3 -11
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/pb_types/database_pb2.pyi +0 -62
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/updater.py +5 -12
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10/src/ry_pg_utils.egg-info}/PKG-INFO +1 -1
- ry_pg_utils-1.0.8/VERSION +0 -1
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/LICENSE +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/MANIFEST.in +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/README.md +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/packages/base_requirements.in +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/pyproject.toml +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/setup.cfg +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/setup.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/__init__.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/config.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/connect.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/dynamic_table.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/ipc/__init__.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/notify_trigger.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/parse_args.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/pb_types/__init__.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/pb_types/py.typed +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/postgres_info.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/py.typed +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/tools/__init__.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils/tools/db_query.py +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils.egg-info/SOURCES.txt +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils.egg-info/dependency_links.txt +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils.egg-info/requires.txt +0 -0
- {ry_pg_utils-1.0.8 → ry_pg_utils-1.0.10}/src/ry_pg_utils.egg-info/top_level.txt +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
1.0.10
|
@@ -3,10 +3,9 @@ from ry_redis_bus.channels import Channel
|
|
3
3
|
from ry_pg_utils.pb_types.database_pb2 import DatabaseConfigPb # pylint: disable=no-name-in-module
|
4
4
|
from ry_pg_utils.pb_types.database_pb2 import ( # pylint: disable=no-name-in-module
|
5
5
|
DatabaseNotificationPb,
|
6
|
-
DatabaseSettingsPb,
|
7
6
|
)
|
8
7
|
|
9
8
|
# Channels
|
10
9
|
DATABASE_CHANNEL = Channel("DATABASE_CHANNEL", DatabaseConfigPb)
|
11
|
-
DATABASE_CONFIG_CHANNEL = Channel("DATABASE_CONFIG_CHANNEL",
|
10
|
+
DATABASE_CONFIG_CHANNEL = Channel("DATABASE_CONFIG_CHANNEL", DatabaseConfigPb)
|
12
11
|
DATABASE_NOTIFY_CHANNEL = Channel("DATABASE_NOTIFY_CHANNEL", DatabaseNotificationPb)
|
@@ -14,25 +14,17 @@ _sym_db = _symbol_database.Default()
|
|
14
14
|
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
15
15
|
|
16
16
|
|
17
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0e\x64\x61tabase.proto\x12\x08\x64\x61tabase\x1a\x1fgoogle/protobuf/timestamp.proto\"m\n\nPostgresPb\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\x12\x0c\n\x04user\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t\x12\x0c\n\x04port\x18\x05 \x01(\x05\x12\x11\n\tbackendId\x18\x06 \x01(\t\"f\n\x11PostgresMessagePb\x12)\n\x05utime\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12&\n\x08postgres\x18\x02 \x01(\x0b\x32\x14.database.PostgresPb\"\
|
17
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0e\x64\x61tabase.proto\x12\x08\x64\x61tabase\x1a\x1fgoogle/protobuf/timestamp.proto\"m\n\nPostgresPb\x12\x10\n\x08\x64\x61tabase\x18\x01 \x01(\t\x12\x0c\n\x04user\x18\x02 \x01(\t\x12\x10\n\x08password\x18\x03 \x01(\t\x12\x0c\n\x04host\x18\x04 \x01(\t\x12\x0c\n\x04port\x18\x05 \x01(\x05\x12\x11\n\tbackendId\x18\x06 \x01(\t\"f\n\x11PostgresMessagePb\x12)\n\x05utime\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12&\n\x08postgres\x18\x02 \x01(\x0b\x32\x14.database.PostgresPb\"\x8e\x01\n\x16\x44\x61tabaseNotificationPb\x12)\n\x05utime\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x12\n\ntable_name\x18\x02 \x01(\t\x12\x14\n\x0c\x63hannel_name\x18\x03 \x01(\t\x12\x0e\n\x06\x61\x63tion\x18\x04 \x01(\t\x12\x0f\n\x07payload\x18\x05 \x01(\tb\x06proto3')
|
18
18
|
|
19
19
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
|
20
20
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'database_pb2', globals())
|
21
21
|
if _descriptor._USE_C_DESCRIPTORS == False:
|
22
22
|
|
23
23
|
DESCRIPTOR._options = None
|
24
|
-
_DATABASESETTINGSPB_POSTGRESENTRY._options = None
|
25
|
-
_DATABASESETTINGSPB_POSTGRESENTRY._serialized_options = b'8\001'
|
26
24
|
_POSTGRESPB._serialized_start=61
|
27
25
|
_POSTGRESPB._serialized_end=170
|
28
26
|
_POSTGRESMESSAGEPB._serialized_start=172
|
29
27
|
_POSTGRESMESSAGEPB._serialized_end=274
|
30
|
-
|
31
|
-
|
32
|
-
_DATABASESETTINGSPB_POSTGRESENTRY._serialized_start=386
|
33
|
-
_DATABASESETTINGSPB_POSTGRESENTRY._serialized_end=455
|
34
|
-
_DATABASECONFIGPB._serialized_start=457
|
35
|
-
_DATABASECONFIGPB._serialized_end=574
|
36
|
-
_DATABASENOTIFICATIONPB._serialized_start=577
|
37
|
-
_DATABASENOTIFICATIONPB._serialized_end=719
|
28
|
+
_DATABASENOTIFICATIONPB._serialized_start=277
|
29
|
+
_DATABASENOTIFICATIONPB._serialized_end=419
|
38
30
|
# @@protoc_insertion_point(module_scope)
|
@@ -4,9 +4,7 @@ isort:skip_file
|
|
4
4
|
"""
|
5
5
|
|
6
6
|
import builtins
|
7
|
-
import collections.abc
|
8
7
|
import google.protobuf.descriptor
|
9
|
-
import google.protobuf.internal.containers
|
10
8
|
import google.protobuf.message
|
11
9
|
import google.protobuf.timestamp_pb2
|
12
10
|
import typing
|
@@ -66,66 +64,6 @@ class PostgresMessagePb(google.protobuf.message.Message):
|
|
66
64
|
|
67
65
|
global___PostgresMessagePb = PostgresMessagePb
|
68
66
|
|
69
|
-
@typing.final
|
70
|
-
class DatabaseSettingsPb(google.protobuf.message.Message):
|
71
|
-
"""Message for DatabaseSettings"""
|
72
|
-
|
73
|
-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
74
|
-
|
75
|
-
@typing.final
|
76
|
-
class PostgresEntry(google.protobuf.message.Message):
|
77
|
-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
78
|
-
|
79
|
-
KEY_FIELD_NUMBER: builtins.int
|
80
|
-
VALUE_FIELD_NUMBER: builtins.int
|
81
|
-
key: builtins.str
|
82
|
-
@property
|
83
|
-
def value(self) -> global___PostgresPb: ...
|
84
|
-
def __init__(
|
85
|
-
self,
|
86
|
-
*,
|
87
|
-
key: builtins.str = ...,
|
88
|
-
value: global___PostgresPb | None = ...,
|
89
|
-
) -> None: ...
|
90
|
-
def HasField(self, field_name: typing.Literal["value", b"value"]) -> builtins.bool: ...
|
91
|
-
def ClearField(self, field_name: typing.Literal["key", b"key", "value", b"value"]) -> None: ...
|
92
|
-
|
93
|
-
PRIMARYDATABASE_FIELD_NUMBER: builtins.int
|
94
|
-
POSTGRES_FIELD_NUMBER: builtins.int
|
95
|
-
primaryDatabase: builtins.bool
|
96
|
-
@property
|
97
|
-
def postgres(self) -> google.protobuf.internal.containers.MessageMap[builtins.str, global___PostgresPb]: ...
|
98
|
-
def __init__(
|
99
|
-
self,
|
100
|
-
*,
|
101
|
-
primaryDatabase: builtins.bool = ...,
|
102
|
-
postgres: collections.abc.Mapping[builtins.str, global___PostgresPb] | None = ...,
|
103
|
-
) -> None: ...
|
104
|
-
def ClearField(self, field_name: typing.Literal["postgres", b"postgres", "primaryDatabase", b"primaryDatabase"]) -> None: ...
|
105
|
-
|
106
|
-
global___DatabaseSettingsPb = DatabaseSettingsPb
|
107
|
-
|
108
|
-
@typing.final
|
109
|
-
class DatabaseConfigPb(google.protobuf.message.Message):
|
110
|
-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
111
|
-
|
112
|
-
UTIME_FIELD_NUMBER: builtins.int
|
113
|
-
DATABASESETTINGS_FIELD_NUMBER: builtins.int
|
114
|
-
@property
|
115
|
-
def utime(self) -> google.protobuf.timestamp_pb2.Timestamp: ...
|
116
|
-
@property
|
117
|
-
def databaseSettings(self) -> global___DatabaseSettingsPb: ...
|
118
|
-
def __init__(
|
119
|
-
self,
|
120
|
-
*,
|
121
|
-
utime: google.protobuf.timestamp_pb2.Timestamp | None = ...,
|
122
|
-
databaseSettings: global___DatabaseSettingsPb | None = ...,
|
123
|
-
) -> None: ...
|
124
|
-
def HasField(self, field_name: typing.Literal["databaseSettings", b"databaseSettings", "utime", b"utime"]) -> builtins.bool: ...
|
125
|
-
def ClearField(self, field_name: typing.Literal["databaseSettings", b"databaseSettings", "utime", b"utime"]) -> None: ...
|
126
|
-
|
127
|
-
global___DatabaseConfigPb = DatabaseConfigPb
|
128
|
-
|
129
67
|
@typing.final
|
130
68
|
class DatabaseNotificationPb(google.protobuf.message.Message):
|
131
69
|
DESCRIPTOR: google.protobuf.descriptor.Descriptor
|
@@ -11,7 +11,6 @@ from ryutils.verbose import Verbose
|
|
11
11
|
from ry_pg_utils.connect import close_engine, init_database, is_database_initialized
|
12
12
|
from ry_pg_utils.ipc import channels
|
13
13
|
from ry_pg_utils.pb_types.database_pb2 import ( # pylint: disable=no-name-in-module
|
14
|
-
DatabaseSettingsPb,
|
15
14
|
PostgresMessagePb,
|
16
15
|
PostgresPb,
|
17
16
|
)
|
@@ -21,20 +20,15 @@ DB_RETRY_TIME = 5.0
|
|
21
20
|
|
22
21
|
|
23
22
|
def get_database_settings(
|
24
|
-
|
23
|
+
raw_db_config_pb: PostgresMessagePb | None, verbose: bool = False
|
25
24
|
) -> T.Optional[PostgresInfo]:
|
26
|
-
raw_db_config_pb = message_pb.postgres.get(backend_id, None)
|
27
|
-
|
28
25
|
if raw_db_config_pb is None:
|
29
26
|
return None
|
30
27
|
|
31
|
-
|
32
|
-
return None
|
33
|
-
|
34
|
-
db_config_pb: PostgresPb = raw_db_config_pb
|
28
|
+
db_config_pb: PostgresPb = raw_db_config_pb.postgres
|
35
29
|
|
36
30
|
if verbose:
|
37
|
-
log.print_normal(f"Received database settings
|
31
|
+
log.print_normal(f"Received database settings:\n{db_config_pb}")
|
38
32
|
|
39
33
|
database_settings_msg = PostgresInfo(
|
40
34
|
db_name=db_config_pb.database,
|
@@ -80,12 +74,11 @@ class DbUpdater(RedisClientBase):
|
|
80
74
|
self.last_db_init_retry_time = 0.0
|
81
75
|
self.use_local_db_only = args.use_local_db_only if args else True
|
82
76
|
self.database_settings_msg: T.Optional[PostgresInfo] = None
|
83
|
-
self.backend_id = backend_id
|
84
77
|
self.logging_error_db_callback = logging_error_db_callback
|
85
78
|
|
86
79
|
@message_handler
|
87
|
-
def handle_database_config_message(self, message_pb:
|
88
|
-
database_settings = get_database_settings(message_pb
|
80
|
+
def handle_database_config_message(self, message_pb: PostgresMessagePb) -> None:
|
81
|
+
database_settings = get_database_settings(message_pb)
|
89
82
|
|
90
83
|
if database_settings is not None:
|
91
84
|
self.database_settings_msg = database_settings
|
ry_pg_utils-1.0.8/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.8
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|