datatoolpack 0.7.4__tar.gz → 0.10.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatoolpack
3
- Version: 0.7.4
3
+ Version: 0.10.0
4
4
  Summary: Official Python SDK for the AutoData ML data preparation pipeline API
5
5
  Home-page: https://autodata.datatoolpack.com
6
6
  Author: AutoData Team
@@ -1,4 +1,4 @@
1
1
  from .client import AutoDataClient, AutoDataError
2
2
 
3
- __version__ = "0.7.4"
3
+ __version__ = "0.10.0"
4
4
  __all__ = ["AutoDataClient", "AutoDataError", "__version__"]
@@ -74,7 +74,7 @@ class AutoDataClient:
74
74
  Args:
75
75
  api_key: API key string starting with ``dtpk_``.
76
76
  base_url: Base URL of the AutoData server (no trailing slash).
77
- timeout: HTTP request timeout in seconds (default 120).
77
+ timeout: HTTP request timeout in seconds (default 300).
78
78
  max_retries: Max automatic retries for transient errors
79
79
  (429 / 502 / 503 / 504). Default 3.
80
80
 
@@ -89,7 +89,7 @@ class AutoDataClient:
89
89
  api_key: Optional[str] = None,
90
90
  passcode: Optional[str] = None,
91
91
  base_url: Optional[str] = None,
92
- timeout: int = 120,
92
+ timeout: int = 300,
93
93
  max_retries: int = 3,
94
94
  ):
95
95
  # Resolve from env vars if not provided explicitly
@@ -195,7 +195,10 @@ class AutoDataClient:
195
195
  return response # let caller handle the error
196
196
  retry_after = int(response.headers.get("Retry-After", 0))
197
197
  wait = max(retry_after, 2 ** attempt)
198
- except requests.ConnectionError as exc:
198
+ except (requests.ConnectionError, requests.Timeout) as exc:
199
+ # Retry transient read/connect timeouts too: a long-running
200
+ # server-side stage can briefly delay a poll past the per-request
201
+ # timeout; that should not fail the whole job.
199
202
  last_exc = exc
200
203
  if attempt == self.max_retries:
201
204
  raise
@@ -364,7 +367,7 @@ class AutoDataClient:
364
367
  session_id: str,
365
368
  poll_interval: int = 2,
366
369
  timeout: Optional[float] = None,
367
- stall_timeout: float = 600.0,
370
+ stall_timeout: float = 3600.0,
368
371
  ) -> Dict:
369
372
  """Block until a session reaches *completed*, *error*, or *cancelled*.
370
373
 
@@ -405,6 +408,8 @@ class AutoDataClient:
405
408
  raise AutoDataError(f"Processing failed: {msg}")
406
409
  if status == "cancelled":
407
410
  raise AutoDataError("Processing was cancelled")
411
+ if status == "failed":
412
+ raise AutoDataError(f"Processing failed: {msg}")
408
413
 
409
414
  # Detect stalled workers: status stays 'unknown'/'processing' with
410
415
  # no progress change. Prevents infinite loops when cpu_worker died.
@@ -771,20 +776,29 @@ class AutoDataClient:
771
776
  Args:
772
777
  connector_type: One of the supported types:
773
778
 
774
- Databases / warehouses:
779
+ Databases:
775
780
  ``sql`` (Postgres/MySQL/MSSQL via SQLAlchemy URL),
776
- ``snowflake``, ``bigquery``, ``redshift``, ``oracle``,
777
- ``databricks``, ``fabric`` (Microsoft Fabric).
781
+ ``mongodb``, ``oracle``, ``cassandra``, ``dynamodb``,
782
+ ``elasticsearch``.
778
783
 
779
- NoSQL:
780
- ``mongodb``, ``cassandra``, ``dynamodb``, ``elasticsearch``.
784
+ Data warehouses:
785
+ ``snowflake``, ``bigquery``, ``redshift``, ``clickhouse``,
786
+ ``databricks``, ``fabric`` (Microsoft Fabric),
787
+ ``synapse`` (Azure Synapse), ``sap_hana`` (SAP HANA).
781
788
 
782
- Object storage / data lakes:
789
+ Object storage / data lakes / files:
783
790
  ``s3``, ``gcs``, ``azure_blob``, ``adls_gen2`` (Azure
784
- Data Lake Storage Gen2), ``delta`` (Delta Lake).
791
+ Data Lake Storage Gen2), ``delta`` (Delta Lake),
792
+ ``google_sheets``.
793
+
794
+ Streaming & IoT / time-series:
795
+ ``kafka``, ``kinesis``, ``mqtt``, ``opcua`` (OPC-UA),
796
+ ``influxdb``, ``timescaledb``, ``pi_web_api``
797
+ (OSIsoft/AVEVA PI).
785
798
 
786
- Streaming:
787
- ``kafka``, ``kinesis``.
799
+ SaaS & apps:
800
+ ``salesforce``, ``hubspot``, ``stripe``, ``ga4``
801
+ (Google Analytics 4), ``netsuite``, ``sharepoint``.
788
802
 
789
803
  Generic:
790
804
  ``http`` (REST/HTTP API).
@@ -929,7 +943,11 @@ class AutoDataClient:
929
943
  custom_query: Optional SQL query (overrides *table*).
930
944
  output_rows: Target row count in output dataset.
931
945
  tools: Toggle pipeline steps (same as :meth:`process`).
946
+ Set ``tools["feature_selection"]=True`` to run F4
947
+ feature selection between DTC and MDH.
932
948
  advanced_params: Fine-grained parameters (same as :meth:`process`).
949
+ ``feature_selection_config`` = ``{method, top_k,
950
+ threshold}`` configures the F4 stage when enabled.
933
951
  wait: Block until processing completes.
934
952
  poll_interval: Seconds between status polls.
935
953
  download_path: Directory to save results.
@@ -977,6 +995,11 @@ class AutoDataClient:
977
995
  body["enable_cds"] = bool(tls.get("cds", True))
978
996
  body["enable_dsm"] = bool(tls.get("dsm", True))
979
997
  body["enable_dsg"] = bool(tls.get("dsg", True))
998
+ body["enable_feature_selection"] = bool(tls.get("feature_selection", False)) # F4 (opt-in)
999
+ # F4 — feature selection config: {method, top_k, threshold}
1000
+ fs_cfg = adv.get("feature_selection_config")
1001
+ if fs_cfg:
1002
+ body["feature_selection_config"] = fs_cfg
980
1003
  if credential_id:
981
1004
  body["credential_id"] = credential_id
982
1005
  if secrets:
@@ -1019,6 +1042,110 @@ class AutoDataClient:
1019
1042
  final["dataframes"] = self.get_dataframes(session_id, names=output_preferences)
1020
1043
  return final
1021
1044
 
1045
+ def recommend_features(
1046
+ self,
1047
+ session_id: str,
1048
+ target_columns: List[str],
1049
+ methods: Optional[List[str]] = None,
1050
+ top_k: int = 20,
1051
+ ) -> Dict:
1052
+ """Rank a completed session's columns (F4) without re-running the pipeline.
1053
+
1054
+ Args:
1055
+ session_id: A completed session owned by the caller.
1056
+ target_columns: Target column name(s) to rank features against.
1057
+ methods: Ranking methods — any of ``variance_threshold``,
1058
+ ``correlation_pruning``, ``mutual_information``,
1059
+ ``rfe``, ``shap_importance``, ``pca``. Defaults to
1060
+ ``["mutual_information"]``.
1061
+ top_k: Number of top features to return (default 20).
1062
+
1063
+ Returns:
1064
+ Dict with ``ranking`` (combined), ``per_method``, and ``warnings``.
1065
+ """
1066
+ body = {
1067
+ "session_id": session_id,
1068
+ "target_columns": target_columns,
1069
+ "methods": methods or ["mutual_information"],
1070
+ "top_k": top_k,
1071
+ }
1072
+ r = self._request("POST", self._url("/feature-selection/recommend"), json=body)
1073
+ self._raise_for_error(r)
1074
+ return r.json()
1075
+
1076
+ # ── F7 — Triggers ─────────────────────────────────────────────────────
1077
+ def list_triggers(self) -> List[Dict]:
1078
+ """List the caller's triggers (webhook secrets are never returned)."""
1079
+ r = self._request("GET", self._url("/triggers"))
1080
+ self._raise_for_error(r)
1081
+ return r.json().get("triggers", [])
1082
+
1083
+ def create_trigger(
1084
+ self,
1085
+ name: str,
1086
+ trigger_type: str,
1087
+ config: Optional[Dict] = None,
1088
+ target_pipeline_config: Optional[Dict] = None,
1089
+ enabled: bool = True,
1090
+ ) -> Dict:
1091
+ """Create a trigger that auto-starts a pipeline on an external event.
1092
+
1093
+ Args:
1094
+ name: Human-readable trigger name.
1095
+ trigger_type: One of ``inbound_webhook``, ``watermark_advance``,
1096
+ ``pipeline_completion``, ``quality_alert``.
1097
+ config: Type-specific config. ``watermark_advance`` needs
1098
+ ``{credential_id, table, watermark_column,
1099
+ min_advance}``; ``inbound_webhook`` accepts an
1100
+ optional ``{hmac_key}``.
1101
+ target_pipeline_config: The pipeline to run when fired — a
1102
+ connector data source + pipeline params
1103
+ (``{source_type, credential_id, table,
1104
+ target_columns, output_rows, ...}``).
1105
+ enabled: Whether the trigger is active (default True).
1106
+
1107
+ Returns:
1108
+ The created trigger. For ``inbound_webhook`` the response
1109
+ includes ``webhook_secret`` and ``inbound_url`` — this is the
1110
+ ONLY time the secret is returned, so save it now.
1111
+ """
1112
+ body = {
1113
+ "name": name,
1114
+ "trigger_type": trigger_type,
1115
+ "config": config or {},
1116
+ "target_pipeline_config": target_pipeline_config or {},
1117
+ "enabled": enabled,
1118
+ }
1119
+ r = self._request("POST", self._url("/triggers"), json=body)
1120
+ self._raise_for_error(r)
1121
+ return r.json().get("trigger", r.json())
1122
+
1123
+ def get_trigger(self, trigger_id: str) -> Dict:
1124
+ """Fetch one trigger by id (secret not included)."""
1125
+ r = self._request("GET", self._url(f"/triggers/{trigger_id}"))
1126
+ self._raise_for_error(r)
1127
+ return r.json().get("trigger", r.json())
1128
+
1129
+ def update_trigger(self, trigger_id: str, **fields) -> Dict:
1130
+ """Update a trigger. Accepts ``name``, ``enabled``, ``config``,
1131
+ ``target_pipeline_config``. The webhook secret is immutable."""
1132
+ r = self._request("PUT", self._url(f"/triggers/{trigger_id}"), json=fields)
1133
+ self._raise_for_error(r)
1134
+ return r.json().get("trigger", r.json())
1135
+
1136
+ def delete_trigger(self, trigger_id: str) -> bool:
1137
+ """Delete a trigger. Returns True on success."""
1138
+ r = self._request("DELETE", self._url(f"/triggers/{trigger_id}"))
1139
+ self._raise_for_error(r)
1140
+ return True
1141
+
1142
+ def test_trigger(self, trigger_id: str) -> Dict:
1143
+ """Dry-run a trigger: validate its config + target without firing.
1144
+ Returns a report with ``would_fire`` and per-check details."""
1145
+ r = self._request("POST", self._url(f"/triggers/{trigger_id}/test"))
1146
+ self._raise_for_error(r)
1147
+ return r.json()
1148
+
1022
1149
  def write_output(
1023
1150
  self,
1024
1151
  session_id: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: datatoolpack
3
- Version: 0.7.4
3
+ Version: 0.10.0
4
4
  Summary: Official Python SDK for the AutoData ML data preparation pipeline API
5
5
  Home-page: https://autodata.datatoolpack.com
6
6
  Author: AutoData Team
@@ -7,7 +7,7 @@ with open(os.path.join(here, "README.md"), encoding="utf-8") as f:
7
7
 
8
8
  setup(
9
9
  name="datatoolpack",
10
- version="0.7.4",
10
+ version="0.10.0",
11
11
  description="Official Python SDK for the AutoData ML data preparation pipeline API",
12
12
  long_description=long_description,
13
13
  long_description_content_type="text/markdown",
File without changes
File without changes