definite-sdk 0.1.16__tar.gz → 0.1.18__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.
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/PKG-INFO +1 -1
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/integration.py +61 -1
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/pyproject.toml +1 -1
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/LICENSE +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/README.md +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/__init__.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/client.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/dlt.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/message.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/py.typed +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/secret.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/sql.py +0 -0
- {definite_sdk-0.1.16 → definite_sdk-0.1.18}/definite_sdk/store.py +0 -0
|
@@ -59,7 +59,7 @@ class DefiniteIntegrationStore:
|
|
|
59
59
|
response.raise_for_status()
|
|
60
60
|
cursor_page = response.json()
|
|
61
61
|
integrations = cursor_page.get("data", [])
|
|
62
|
-
details = [i.get("details", {}) for i in integrations]
|
|
62
|
+
details = [{"id": i.get("id"), **i.get("details", {})} for i in integrations]
|
|
63
63
|
return cast(List[Dict], details)
|
|
64
64
|
|
|
65
65
|
def get_integration(self, name: str) -> Dict:
|
|
@@ -128,3 +128,63 @@ class DefiniteIntegrationStore:
|
|
|
128
128
|
raise Exception("Integration with type `duckdb` not found")
|
|
129
129
|
integration = integrations[0]
|
|
130
130
|
return integration.get("details", {})
|
|
131
|
+
|
|
132
|
+
def get_syncs(
|
|
133
|
+
self,
|
|
134
|
+
integration_id: str,
|
|
135
|
+
*,
|
|
136
|
+
limit: int = 50,
|
|
137
|
+
offset: int = 0,
|
|
138
|
+
desc: bool = True,
|
|
139
|
+
status: Optional[str] = None,
|
|
140
|
+
) -> List[Dict]:
|
|
141
|
+
"""
|
|
142
|
+
Retrieves sync runs (DAG runs) for an integration.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
integration_id (str): The ID of the integration.
|
|
146
|
+
limit (int): Maximum number of results to return (default: 50, max: 100).
|
|
147
|
+
offset (int): Number of results to skip for pagination (default: 0).
|
|
148
|
+
desc (bool): Sort by created_at descending if True (default: True).
|
|
149
|
+
status (str): Optional filter by status ("STARTED", "SUCCESS", "FAILED").
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
List[Dict]: List of DAG run records with keys:
|
|
153
|
+
- dag_name: Name of the DAG
|
|
154
|
+
- run_id: Unique ID for this run
|
|
155
|
+
- created_at: ISO datetime when created
|
|
156
|
+
- updated_at: ISO datetime when updated
|
|
157
|
+
- src_integration_id: Source integration UUID
|
|
158
|
+
- dst_integration_id: Destination integration UUID
|
|
159
|
+
- status: Run status (STARTED, SUCCESS, FAILED)
|
|
160
|
+
- details: Additional run details
|
|
161
|
+
"""
|
|
162
|
+
params: Dict = {
|
|
163
|
+
"limit": limit,
|
|
164
|
+
"offset": offset,
|
|
165
|
+
"desc": str(desc).lower(),
|
|
166
|
+
}
|
|
167
|
+
if status:
|
|
168
|
+
params["status"] = status
|
|
169
|
+
|
|
170
|
+
response = requests.get(
|
|
171
|
+
f"{self._integrations_url}/{integration_id}/syncs",
|
|
172
|
+
params=params,
|
|
173
|
+
headers={"Authorization": "Bearer " + self._api_key},
|
|
174
|
+
)
|
|
175
|
+
response.raise_for_status()
|
|
176
|
+
cursor_page = response.json()
|
|
177
|
+
return cast(List[Dict], cursor_page.get("data", []))
|
|
178
|
+
|
|
179
|
+
def get_latest_sync(self, integration_id: str) -> Optional[Dict]:
|
|
180
|
+
"""
|
|
181
|
+
Retrieves the most recent sync run for an integration.
|
|
182
|
+
|
|
183
|
+
Args:
|
|
184
|
+
integration_id (str): The ID of the integration.
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
Optional[Dict]: The most recent DAG run, or None if no syncs exist.
|
|
188
|
+
"""
|
|
189
|
+
syncs = self.get_syncs(integration_id, limit=1, desc=True)
|
|
190
|
+
return syncs[0] if syncs else None
|
|
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
|