datamasque-python 1.1.1__py3-none-any.whl → 1.1.3__py3-none-any.whl

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.
@@ -33,6 +33,7 @@ from datamasque.client.models.connection import (
33
33
  DatabaseConnectionConfig,
34
34
  DatabaseType,
35
35
  DatabricksConnectionConfig,
36
+ DocumentDbConnectionConfig,
36
37
  DynamoConnectionConfig,
37
38
  FileConnectionConfig,
38
39
  MongoConnectionConfig,
@@ -150,6 +151,7 @@ __all__ = [
150
151
  "DiscoveryConfigNotFoundError",
151
152
  "DiscoveryConfigType",
152
153
  "DiscoveryMatch",
154
+ "DocumentDbConnectionConfig",
153
155
  "DynamoConnectionConfig",
154
156
  "FailedToStartError",
155
157
  "FileConnectionConfig",
@@ -166,7 +166,7 @@ class DiscoveryClient(BaseClient):
166
166
  returns a list containing one ruleset
167
167
 
168
168
  Raises `AsyncRulesetGenerationInProgressError` if the task hasn't finished yet,
169
- and `DataMasqueException` if it failed.
169
+ and `DataMasqueException` if it failed or was cancelled.
170
170
 
171
171
  Note that the ruleset(s) have autogenerated names, which you may want to customize before uploading.
172
172
  """
@@ -176,7 +176,11 @@ class DiscoveryClient(BaseClient):
176
176
  logger.error("Ruleset generation failed for connection: %s", connection_id)
177
177
  raise DataMasqueException(f"Ruleset generation failed for connection: {connection_id}")
178
178
 
179
- if status is not AsyncRulesetGenerationTaskStatus.finished:
179
+ if status is AsyncRulesetGenerationTaskStatus.cancelled:
180
+ logger.error("Ruleset generation was cancelled for connection: %s", connection_id)
181
+ raise DataMasqueException(f"Ruleset generation was cancelled for connection: {connection_id}")
182
+
183
+ if not status.is_finished:
180
184
  logger.error(
181
185
  "Ruleset generation is still in progress for connection: %s. Status: `%s`",
182
186
  connection_id,
@@ -44,6 +44,7 @@ class DatabaseType(Enum):
44
44
  mssql_linked = "mssql_linked"
45
45
  snowflake = "snowflake"
46
46
  mongodb = "mongodb"
47
+ documentdb = "documentdb"
47
48
  databricks_lakebase = "databricks_lakebase"
48
49
  databricks = "databricks"
49
50
  informix = "informix"
@@ -160,6 +161,8 @@ class MongoConnectionConfig(ConnectionConfig):
160
161
  password: Optional[str] = None
161
162
  auth_source: str = "admin"
162
163
  tls: bool = False
164
+ tls_ca_file: str = ""
165
+ tls_allow_invalid_certificates: bool = False
163
166
  direct_connection: bool = False
164
167
  replica_set: str = ""
165
168
  is_read_only: bool = False
@@ -180,6 +183,13 @@ class MongoConnectionConfig(ConnectionConfig):
180
183
  d["dbpassword"] = password
181
184
  if not d.get("tls"):
182
185
  d.pop("tls", None)
186
+ d.pop("tls_ca_file", None)
187
+ d.pop("tls_allow_invalid_certificates", None)
188
+ else:
189
+ if not d.get("tls_ca_file"):
190
+ d.pop("tls_ca_file", None)
191
+ if not d.get("tls_allow_invalid_certificates"):
192
+ d.pop("tls_allow_invalid_certificates", None)
183
193
  if not d.get("direct_connection"):
184
194
  d.pop("direct_connection", None)
185
195
  if not d.get("replica_set"):
@@ -197,6 +207,23 @@ class MongoConnectionConfig(ConnectionConfig):
197
207
  return data
198
208
 
199
209
 
210
+ class DocumentDbConnectionConfig(MongoConnectionConfig):
211
+ """
212
+ Connection configuration for an AWS DocumentDB cluster.
213
+
214
+ DocumentDB is MongoDB wire-compatible,
215
+ so it reuses `MongoConnectionConfig` (including the TLS handling)
216
+ and only differs by `db_type`/`database_type`.
217
+ """
218
+
219
+ # Narrowing the inherited Literal is a deliberate Pydantic discriminator override.
220
+ db_type: Literal["documentdb"] = "documentdb" # type: ignore[assignment]
221
+
222
+ @property
223
+ def database_type(self) -> DatabaseType:
224
+ return DatabaseType.documentdb
225
+
226
+
200
227
  class SnowflakeConnectionConfig(ConnectionConfig):
201
228
  """
202
229
  Connection configuration for a Snowflake database.
@@ -430,6 +457,7 @@ FILE_TYPE_MAP: dict[str, type[FileConnectionConfig]] = {
430
457
  DB_TYPE_MAP: dict[str, type[ConnectionConfig]] = {
431
458
  DatabaseType.dynamodb.value: DynamoConnectionConfig,
432
459
  DatabaseType.mongodb.value: MongoConnectionConfig,
460
+ DatabaseType.documentdb.value: DocumentDbConnectionConfig,
433
461
  DatabaseType.snowflake.value: SnowflakeConnectionConfig,
434
462
  DatabaseType.mssql_linked.value: MssqlLinkedServerConnectionConfig,
435
463
  DatabaseType.databricks.value: DatabricksConnectionConfig,
@@ -64,15 +64,28 @@ class AsyncRulesetGenerationTaskStatus(enum.Enum):
64
64
  failed = "failed"
65
65
  running = "running"
66
66
  queued = "queued"
67
+ cancelled = "cancelled"
67
68
 
68
69
  @classmethod
69
70
  def get_final_states(cls) -> set["AsyncRulesetGenerationTaskStatus"]:
70
71
  """Returns the list of final statuses, i.e. the ruleset generation has completed, successfully or otherwise."""
71
72
 
72
- return {cls.finished, cls.failed}
73
+ return {cls.finished, cls.finished_with_warnings, cls.failed, cls.cancelled}
74
+
75
+ @classmethod
76
+ def get_finished_states(cls) -> set["AsyncRulesetGenerationTaskStatus"]:
77
+ """Returns the list of statuses that indicate the ruleset generation completed successfully."""
78
+
79
+ return {cls.finished, cls.finished_with_warnings}
73
80
 
74
81
  @property
75
82
  def is_in_final_state(self) -> bool:
76
83
  """Returns True if this status is a final status."""
77
84
 
78
85
  return self in self.get_final_states()
86
+
87
+ @property
88
+ def is_finished(self) -> bool:
89
+ """Returns True if this status is a finished status."""
90
+
91
+ return self in self.get_finished_states()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datamasque-python
3
- Version: 1.1.1
3
+ Version: 1.1.3
4
4
  Summary: Official Python client for the DataMasque data-masking API.
5
5
  Project-URL: Homepage, https://datamasque.com/
6
6
  Project-URL: Documentation, https://datamasque-python.readthedocs.io/
@@ -1,7 +1,7 @@
1
- datamasque/client/__init__.py,sha256=GmpVFNWZPu6jyadhY6SOZp4hLR1wUc4cgzwLcqoEA5o,6312
1
+ datamasque/client/__init__.py,sha256=bW7Iy-iNxpaYgc_X035KAL-hmOVgr8YcYh5s398zawo,6378
2
2
  datamasque/client/base.py,sha256=vP1LuYbqq6U8NAEJWnwNrdt_Fa2wjQTJXHf0gSFO79c,14115
3
3
  datamasque/client/connections.py,sha256=EFinx8fJRme0mTxuWY3d29UnmUFbsQhMaUQT0Ma2PK4,2885
4
- datamasque/client/discovery.py,sha256=j83yCBlG2xRNQlv2zb6plwL3qcCT1m3nXABG0JRdh_w,21009
4
+ datamasque/client/discovery.py,sha256=MTDiif6YWkv64hHXZ8YJxtRhoeKIvQVfjNYvjCIZCXE,21261
5
5
  datamasque/client/discovery_configs.py,sha256=G-W-X_KizjjQLa-Rb6ixLjlkxbkCe4WGCOfYZrGtxIk,6420
6
6
  datamasque/client/dmclient.py,sha256=tA7V8GEQmnsalTHUZch8YmIUynYw2ldK-mmUGbofFL4,1650
7
7
  datamasque/client/exceptions.py,sha256=Tx7tE6i1X_oemR3EOJC97_sihZiToHqGuOQmWWxs_BE,3131
@@ -15,7 +15,7 @@ datamasque/client/runs.py,sha256=l_JpYgelqsDKW_O6LtsHC60IMXHG9ak_RwVnuvJKE1I,770
15
15
  datamasque/client/settings.py,sha256=Ui8AyR2XdoW8MZ9FIrGn2jm8DLzUGWIL8i2DOTvu7hc,2898
16
16
  datamasque/client/users.py,sha256=VCUo2CJyOw4-aO_3mp_w_0BcSoa6-h1HcReMcAMyumw,3701
17
17
  datamasque/client/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
- datamasque/client/models/connection.py,sha256=TSv-bbOFlYCRBZHJiRgiwNuN0es_GdJd-_L3LUsQ-dI,15773
18
+ datamasque/client/models/connection.py,sha256=Mh7MyTQmF0bllu0rurnFXmbiiq7Htc4bTwK5WQiPXSk,16823
19
19
  datamasque/client/models/data_selection.py,sha256=406yyUZ5NmLBSql2lYM1gsTWY5GWmnutmF-DjznAoLc,1904
20
20
  datamasque/client/models/discovery.py,sha256=WHSIkFebQ5m47K_BdxY1lvCeeF23q_BbZan7Ryuh5vY,13198
21
21
  datamasque/client/models/discovery_config.py,sha256=1CHMgSxMXuarPGfRcz9wX7jeZLn1SDw0UEe-L5naE54,1917
@@ -28,9 +28,9 @@ datamasque/client/models/pagination.py,sha256=egg9aO2cf6KUDwDANPu5RxpJbdRKdwUdCQ
28
28
  datamasque/client/models/ruleset.py,sha256=ZYv6SmcrONV5rLK0tKjhlKCwZiCU1dMYtH7olxI4l5A,1678
29
29
  datamasque/client/models/ruleset_library.py,sha256=5UbL_M47mgPedo8xt4q5crUh4aeOVoEMAEKbGO8CfiY,950
30
30
  datamasque/client/models/runs.py,sha256=UtPMGCJFLFP1f2nyVGAbl3A5_wAONrRNJ63y43Hbpi0,6213
31
- datamasque/client/models/status.py,sha256=AcKK7lelGeRCKGuWL3K9i7SiTpOIVTglyveu0tzJEVc,2374
31
+ datamasque/client/models/status.py,sha256=UUEDHd3CQZA1Mf-1LyhAiE4COuCWvAz5oJx5ECVIwp4,2868
32
32
  datamasque/client/models/user.py,sha256=UGAUzgJkf78m24_zFXXoA99zdut48BXkX_ivV8yq1Vc,2043
33
- datamasque_python-1.1.1.dist-info/METADATA,sha256=TZeVZqLa38CsvBQS1wmS0xXh3nSWGyn5GKnIz5j2RXg,4187
34
- datamasque_python-1.1.1.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
35
- datamasque_python-1.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
36
- datamasque_python-1.1.1.dist-info/RECORD,,
33
+ datamasque_python-1.1.3.dist-info/METADATA,sha256=1OFcE21laJ8mFsaUCuJaGFssUJFsZzsDen7tpW59gUA,4187
34
+ datamasque_python-1.1.3.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
35
+ datamasque_python-1.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
36
+ datamasque_python-1.1.3.dist-info/RECORD,,