databar 2.0.0__tar.gz → 2.0.1__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.
- {databar-2.0.0/src/databar.egg-info → databar-2.0.1}/PKG-INFO +2 -2
- {databar-2.0.0 → databar-2.0.1}/README.md +1 -1
- {databar-2.0.0 → databar-2.0.1}/pyproject.toml +1 -1
- {databar-2.0.0 → databar-2.0.1}/src/databar/__init__.py +3 -1
- {databar-2.0.0 → databar-2.0.1}/src/databar/client.py +13 -12
- {databar-2.0.0 → databar-2.0.1}/src/databar/models.py +24 -1
- {databar-2.0.0 → databar-2.0.1/src/databar.egg-info}/PKG-INFO +2 -2
- {databar-2.0.0 → databar-2.0.1}/tests/test_cli.py +2 -2
- {databar-2.0.0 → databar-2.0.1}/tests/test_client.py +4 -3
- {databar-2.0.0 → databar-2.0.1}/LICENSE +0 -0
- {databar-2.0.0 → databar-2.0.1}/setup.cfg +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/__init__.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/_auth.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/_output.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/app.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/enrichments.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/tables.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/tasks.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/cli/waterfalls.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar/exceptions.py +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar.egg-info/SOURCES.txt +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar.egg-info/dependency_links.txt +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar.egg-info/entry_points.txt +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar.egg-info/requires.txt +0 -0
- {databar-2.0.0 → databar-2.0.1}/src/databar.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databar
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Official Databar.ai Python SDK and CLI — connect to enrichments, waterfalls, and tables via api.databar.ai
|
|
5
5
|
Author-email: "Databar.ai Team" <info@databar.ai>
|
|
6
6
|
License: MIT License
|
|
@@ -139,7 +139,7 @@ for param in enrichment.params:
|
|
|
139
139
|
|
|
140
140
|
# Run single enrichment (async — returns task)
|
|
141
141
|
task = client.run_enrichment(123, {"email": "alice@example.com"})
|
|
142
|
-
data = client.poll_task(task.
|
|
142
|
+
data = client.poll_task(task.task_id)
|
|
143
143
|
|
|
144
144
|
# Run single enrichment (sync convenience wrapper)
|
|
145
145
|
data = client.run_enrichment_sync(123, {"email": "alice@example.com"})
|
|
@@ -84,7 +84,7 @@ for param in enrichment.params:
|
|
|
84
84
|
|
|
85
85
|
# Run single enrichment (async — returns task)
|
|
86
86
|
task = client.run_enrichment(123, {"email": "alice@example.com"})
|
|
87
|
-
data = client.poll_task(task.
|
|
87
|
+
data = client.poll_task(task.task_id)
|
|
88
88
|
|
|
89
89
|
# Run single enrichment (sync convenience wrapper)
|
|
90
90
|
data = client.run_enrichment_sync(123, {"email": "alice@example.com"})
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "databar"
|
|
7
|
-
version = "2.0.
|
|
7
|
+
version = "2.0.1"
|
|
8
8
|
description = "Official Databar.ai Python SDK and CLI — connect to enrichments, waterfalls, and tables via api.databar.ai"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -45,6 +45,7 @@ from .models import (
|
|
|
45
45
|
EnrichmentSummary,
|
|
46
46
|
InsertOptions,
|
|
47
47
|
InsertRow,
|
|
48
|
+
RunResponse,
|
|
48
49
|
Table,
|
|
49
50
|
TableEnrichment,
|
|
50
51
|
TaskResponse,
|
|
@@ -56,7 +57,7 @@ from .models import (
|
|
|
56
57
|
WaterfallEnrichment,
|
|
57
58
|
)
|
|
58
59
|
|
|
59
|
-
__version__ = "2.0.
|
|
60
|
+
__version__ = "2.0.1"
|
|
60
61
|
__all__ = [
|
|
61
62
|
"DatabarClient",
|
|
62
63
|
# exceptions
|
|
@@ -78,6 +79,7 @@ __all__ = [
|
|
|
78
79
|
"ChoiceItem",
|
|
79
80
|
"Choices",
|
|
80
81
|
"ChoicesResponse",
|
|
82
|
+
"RunResponse",
|
|
81
83
|
"TaskResponse",
|
|
82
84
|
"TaskStatus",
|
|
83
85
|
"Waterfall",
|
|
@@ -42,6 +42,7 @@ from .models import (
|
|
|
42
42
|
EnrichmentSummary,
|
|
43
43
|
InsertOptions,
|
|
44
44
|
InsertRow,
|
|
45
|
+
RunResponse,
|
|
45
46
|
Table,
|
|
46
47
|
TableEnrichment,
|
|
47
48
|
TaskResponse,
|
|
@@ -270,31 +271,31 @@ class DatabarClient:
|
|
|
270
271
|
data = self._request("GET", f"/enrichments/{enrichment_id}")
|
|
271
272
|
return Enrichment.model_validate(data)
|
|
272
273
|
|
|
273
|
-
def run_enrichment(self, enrichment_id: int, params: Dict[str, Any]) ->
|
|
274
|
+
def run_enrichment(self, enrichment_id: int, params: Dict[str, Any]) -> RunResponse:
|
|
274
275
|
"""Submit an enrichment run. Returns a task — use poll_task() or run_enrichment_sync()."""
|
|
275
276
|
data = self._request("POST", f"/enrichments/{enrichment_id}/run", json={"params": params})
|
|
276
|
-
return
|
|
277
|
+
return RunResponse.model_validate(data)
|
|
277
278
|
|
|
278
279
|
def run_enrichment_bulk(
|
|
279
280
|
self, enrichment_id: int, params: List[Dict[str, Any]]
|
|
280
|
-
) ->
|
|
281
|
+
) -> RunResponse:
|
|
281
282
|
"""Submit a bulk enrichment run for multiple inputs."""
|
|
282
283
|
data = self._request("POST", f"/enrichments/{enrichment_id}/bulk-run", json={"params": params})
|
|
283
|
-
return
|
|
284
|
+
return RunResponse.model_validate(data)
|
|
284
285
|
|
|
285
286
|
def run_enrichment_sync(
|
|
286
287
|
self, enrichment_id: int, params: Dict[str, Any]
|
|
287
288
|
) -> Any:
|
|
288
289
|
"""Submit and poll an enrichment, returning final data when complete."""
|
|
289
290
|
task = self.run_enrichment(enrichment_id, params)
|
|
290
|
-
return self.poll_task(task.
|
|
291
|
+
return self.poll_task(task.task_id)
|
|
291
292
|
|
|
292
293
|
def run_enrichment_bulk_sync(
|
|
293
294
|
self, enrichment_id: int, params: List[Dict[str, Any]]
|
|
294
295
|
) -> Any:
|
|
295
296
|
"""Submit and poll a bulk enrichment, returning final data when complete."""
|
|
296
297
|
task = self.run_enrichment_bulk(enrichment_id, params)
|
|
297
|
-
return self.poll_task(task.
|
|
298
|
+
return self.poll_task(task.task_id)
|
|
298
299
|
|
|
299
300
|
def get_param_choices(
|
|
300
301
|
self,
|
|
@@ -335,7 +336,7 @@ class DatabarClient:
|
|
|
335
336
|
params: Dict[str, Any],
|
|
336
337
|
enrichments: Optional[List[int]] = None,
|
|
337
338
|
email_verifier: Optional[int] = None,
|
|
338
|
-
) ->
|
|
339
|
+
) -> RunResponse:
|
|
339
340
|
"""
|
|
340
341
|
Submit a waterfall run.
|
|
341
342
|
|
|
@@ -351,7 +352,7 @@ class DatabarClient:
|
|
|
351
352
|
payload["email_verifier"] = email_verifier
|
|
352
353
|
|
|
353
354
|
data = self._request("POST", f"/waterfalls/{identifier}/run", json=payload)
|
|
354
|
-
return
|
|
355
|
+
return RunResponse.model_validate(data)
|
|
355
356
|
|
|
356
357
|
def run_waterfall_bulk(
|
|
357
358
|
self,
|
|
@@ -359,7 +360,7 @@ class DatabarClient:
|
|
|
359
360
|
params: List[Dict[str, Any]],
|
|
360
361
|
enrichments: Optional[List[int]] = None,
|
|
361
362
|
email_verifier: Optional[int] = None,
|
|
362
|
-
) ->
|
|
363
|
+
) -> RunResponse:
|
|
363
364
|
"""Submit a bulk waterfall run for multiple inputs."""
|
|
364
365
|
if not enrichments:
|
|
365
366
|
waterfall = self.get_waterfall(identifier)
|
|
@@ -370,7 +371,7 @@ class DatabarClient:
|
|
|
370
371
|
payload["email_verifier"] = email_verifier
|
|
371
372
|
|
|
372
373
|
data = self._request("POST", f"/waterfalls/{identifier}/bulk-run", json=payload)
|
|
373
|
-
return
|
|
374
|
+
return RunResponse.model_validate(data)
|
|
374
375
|
|
|
375
376
|
def run_waterfall_sync(
|
|
376
377
|
self,
|
|
@@ -381,7 +382,7 @@ class DatabarClient:
|
|
|
381
382
|
) -> Any:
|
|
382
383
|
"""Submit and poll a waterfall, returning final data when complete."""
|
|
383
384
|
task = self.run_waterfall(identifier, params, enrichments, email_verifier)
|
|
384
|
-
return self.poll_task(task.
|
|
385
|
+
return self.poll_task(task.task_id)
|
|
385
386
|
|
|
386
387
|
def run_waterfall_bulk_sync(
|
|
387
388
|
self,
|
|
@@ -392,7 +393,7 @@ class DatabarClient:
|
|
|
392
393
|
) -> Any:
|
|
393
394
|
"""Submit and poll a bulk waterfall, returning final data when complete."""
|
|
394
395
|
task = self.run_waterfall_bulk(identifier, params, enrichments, email_verifier)
|
|
395
|
-
return self.poll_task(task.
|
|
396
|
+
return self.poll_task(task.task_id)
|
|
396
397
|
|
|
397
398
|
# -----------------------------------------------------------------------
|
|
398
399
|
# Tables
|
|
@@ -104,8 +104,24 @@ class TaskStatus(str, Enum):
|
|
|
104
104
|
GONE = "gone"
|
|
105
105
|
|
|
106
106
|
|
|
107
|
+
class RunResponse(BaseModel):
|
|
108
|
+
"""Returned by all /run and /bulk-run endpoints. Contains the task_id to poll."""
|
|
109
|
+
|
|
110
|
+
task_id: str = Field(description="Unique identifier of the submitted task.")
|
|
111
|
+
status: str = Field(default="processing")
|
|
112
|
+
|
|
113
|
+
|
|
107
114
|
class TaskResponse(BaseModel):
|
|
108
|
-
|
|
115
|
+
"""Returned by GET /v1/tasks/{task_id}.
|
|
116
|
+
|
|
117
|
+
The backend currently uses 'request_id' as the field name; this model
|
|
118
|
+
accepts both 'task_id' and 'request_id' so it works before and after
|
|
119
|
+
the backend renames the field.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
task_id: str = Field(
|
|
123
|
+
description="Unique identifier of the task.",
|
|
124
|
+
)
|
|
109
125
|
status: str = Field(
|
|
110
126
|
description="Current status: processing, completed, failed, or gone."
|
|
111
127
|
)
|
|
@@ -114,6 +130,13 @@ class TaskResponse(BaseModel):
|
|
|
114
130
|
description="Resulting data once completed.",
|
|
115
131
|
)
|
|
116
132
|
error: Optional[Union[str, List[str]]] = None
|
|
133
|
+
credits_spent: float = 0
|
|
134
|
+
|
|
135
|
+
@classmethod
|
|
136
|
+
def model_validate(cls, obj: Any, **kwargs: Any) -> "TaskResponse":
|
|
137
|
+
if isinstance(obj, dict) and "task_id" not in obj and "request_id" in obj:
|
|
138
|
+
obj = {**obj, "task_id": obj["request_id"]}
|
|
139
|
+
return super().model_validate(obj, **kwargs)
|
|
117
140
|
|
|
118
141
|
|
|
119
142
|
# ===========================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databar
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.1
|
|
4
4
|
Summary: Official Databar.ai Python SDK and CLI — connect to enrichments, waterfalls, and tables via api.databar.ai
|
|
5
5
|
Author-email: "Databar.ai Team" <info@databar.ai>
|
|
6
6
|
License: MIT License
|
|
@@ -139,7 +139,7 @@ for param in enrichment.params:
|
|
|
139
139
|
|
|
140
140
|
# Run single enrichment (async — returns task)
|
|
141
141
|
task = client.run_enrichment(123, {"email": "alice@example.com"})
|
|
142
|
-
data = client.poll_task(task.
|
|
142
|
+
data = client.poll_task(task.task_id)
|
|
143
143
|
|
|
144
144
|
# Run single enrichment (sync convenience wrapper)
|
|
145
145
|
data = client.run_enrichment_sync(123, {"email": "alice@example.com"})
|
|
@@ -110,7 +110,7 @@ def _client_mock(**method_overrides):
|
|
|
110
110
|
m.get_table_enrichments.return_value = [TableEnrichment(id=5, name="My Enrichment")]
|
|
111
111
|
m.add_enrichment.return_value = {"status": "ok"}
|
|
112
112
|
m.run_table_enrichment.return_value = {"status": "triggered"}
|
|
113
|
-
m.get_task.return_value = TaskResponse(
|
|
113
|
+
m.get_task.return_value = TaskResponse(task_id="t1", status="completed", data={"result": "ok"})
|
|
114
114
|
m.poll_task.return_value = {"result": "ok"}
|
|
115
115
|
|
|
116
116
|
for method, return_value in method_overrides.items():
|
|
@@ -329,4 +329,4 @@ def test_task_get_poll(monkeypatch):
|
|
|
329
329
|
def test_version_flag():
|
|
330
330
|
result = runner.invoke(app, ["--version"])
|
|
331
331
|
assert result.exit_code == 0
|
|
332
|
-
assert "2.0.
|
|
332
|
+
assert "2.0.1" in result.output
|
|
@@ -29,6 +29,7 @@ from databar.models import (
|
|
|
29
29
|
BatchUpdateResponse,
|
|
30
30
|
BatchUpdateRow,
|
|
31
31
|
InsertRow,
|
|
32
|
+
RunResponse,
|
|
32
33
|
UpsertResponse,
|
|
33
34
|
UpsertRow,
|
|
34
35
|
)
|
|
@@ -150,7 +151,7 @@ def test_get_enrichment(client: DatabarClient, httpx_mock: HTTPXMock):
|
|
|
150
151
|
def test_run_enrichment_returns_task(client: DatabarClient, httpx_mock: HTTPXMock):
|
|
151
152
|
httpx_mock.add_response(url=f"{BASE_URL}/enrichments/1/run", json=task_payload("processing"))
|
|
152
153
|
task = client.run_enrichment(1, {"email": "test@example.com"})
|
|
153
|
-
assert task.
|
|
154
|
+
assert task.task_id == "task-123"
|
|
154
155
|
assert task.status == "processing"
|
|
155
156
|
|
|
156
157
|
|
|
@@ -163,7 +164,7 @@ def test_run_enrichment_sync(client: DatabarClient, httpx_mock: HTTPXMock):
|
|
|
163
164
|
|
|
164
165
|
def test_run_enrichment_sync_failed(client: DatabarClient, httpx_mock: HTTPXMock):
|
|
165
166
|
httpx_mock.add_response(url=f"{BASE_URL}/enrichments/1/run", json=task_payload("processing"))
|
|
166
|
-
httpx_mock.add_response(url=f"{BASE_URL}/tasks/task-123", json={"
|
|
167
|
+
httpx_mock.add_response(url=f"{BASE_URL}/tasks/task-123", json={"task_id": "task-123", "status": "failed", "data": None, "error": "upstream error"})
|
|
167
168
|
with pytest.raises(DatabarTaskFailedError, match="upstream error"):
|
|
168
169
|
client.run_enrichment_sync(1, {"email": "test@example.com"})
|
|
169
170
|
|
|
@@ -193,7 +194,7 @@ def test_run_waterfall_auto_resolves_providers(client: DatabarClient, httpx_mock
|
|
|
193
194
|
httpx_mock.add_response(url=f"{BASE_URL}/waterfalls/email_getter", json=waterfall_payload())
|
|
194
195
|
httpx_mock.add_response(url=f"{BASE_URL}/waterfalls/email_getter/run", json=task_payload("processing"))
|
|
195
196
|
task = client.run_waterfall("email_getter", {"linkedin_url": "https://linkedin.com/in/alice"})
|
|
196
|
-
assert task.
|
|
197
|
+
assert task.task_id == "task-123"
|
|
197
198
|
req = httpx_mock.get_requests()[-1]
|
|
198
199
|
body = json.loads(req.content)
|
|
199
200
|
assert body["enrichments"] == [10, 11]
|
|
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
|