databar 2.0.6__tar.gz → 2.0.7__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.
Files changed (28) hide show
  1. {databar-2.0.6/src/databar.egg-info → databar-2.0.7}/PKG-INFO +1 -1
  2. {databar-2.0.6 → databar-2.0.7}/pyproject.toml +1 -1
  3. {databar-2.0.6 → databar-2.0.7}/src/databar/__init__.py +1 -1
  4. databar-2.0.7/src/databar/cli/_guide.py +237 -0
  5. {databar-2.0.6 → databar-2.0.7/src/databar.egg-info}/PKG-INFO +1 -1
  6. {databar-2.0.6 → databar-2.0.7}/tests/test_cli.py +1 -1
  7. databar-2.0.6/src/databar/cli/_guide.py +0 -137
  8. {databar-2.0.6 → databar-2.0.7}/LICENSE +0 -0
  9. {databar-2.0.6 → databar-2.0.7}/README.md +0 -0
  10. {databar-2.0.6 → databar-2.0.7}/setup.cfg +0 -0
  11. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/__init__.py +0 -0
  12. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/_auth.py +0 -0
  13. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/_onboard.py +0 -0
  14. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/_output.py +0 -0
  15. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/app.py +0 -0
  16. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/enrichments.py +0 -0
  17. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/tables.py +0 -0
  18. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/tasks.py +0 -0
  19. {databar-2.0.6 → databar-2.0.7}/src/databar/cli/waterfalls.py +0 -0
  20. {databar-2.0.6 → databar-2.0.7}/src/databar/client.py +0 -0
  21. {databar-2.0.6 → databar-2.0.7}/src/databar/exceptions.py +0 -0
  22. {databar-2.0.6 → databar-2.0.7}/src/databar/models.py +0 -0
  23. {databar-2.0.6 → databar-2.0.7}/src/databar.egg-info/SOURCES.txt +0 -0
  24. {databar-2.0.6 → databar-2.0.7}/src/databar.egg-info/dependency_links.txt +0 -0
  25. {databar-2.0.6 → databar-2.0.7}/src/databar.egg-info/entry_points.txt +0 -0
  26. {databar-2.0.6 → databar-2.0.7}/src/databar.egg-info/requires.txt +0 -0
  27. {databar-2.0.6 → databar-2.0.7}/src/databar.egg-info/top_level.txt +0 -0
  28. {databar-2.0.6 → databar-2.0.7}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databar
3
- Version: 2.0.6
3
+ Version: 2.0.7
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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "databar"
7
- version = "2.0.6"
7
+ version = "2.0.7"
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" }
@@ -58,7 +58,7 @@ from .models import (
58
58
  WaterfallEnrichment,
59
59
  )
60
60
 
61
- __version__ = "2.0.6"
61
+ __version__ = "2.0.7"
62
62
  __all__ = [
63
63
  "DatabarClient",
64
64
  # exceptions
@@ -0,0 +1,237 @@
1
+ """Embedded agent guide — printed by `databar agent-guide`."""
2
+
3
+ AGENT_GUIDE = r"""# Databar — Agent Guide
4
+
5
+ Databar is a data enrichment platform. The `databar` package ships both a
6
+ **CLI** and a **Python SDK**. This guide tells you exactly how to set up and
7
+ use each, including common pitfalls.
8
+
9
+ ---
10
+
11
+ ## STEP 1 — Check authentication
12
+
13
+ Before doing anything else, check whether the user is already authenticated:
14
+
15
+ ```bash
16
+ # Check 1: env var
17
+ echo $DATABAR_API_KEY
18
+
19
+ # Check 2: saved config
20
+ cat ~/.databar/config
21
+ ```
22
+
23
+ If neither exists, the user is not authenticated. Ask them in chat:
24
+
25
+ "Please provide your Databar API key. You can find it at databar.ai → Settings → API Keys."
26
+
27
+ Once they give it to you, save it non-interactively:
28
+
29
+ ```bash
30
+ databar login --api-key <key they provided>
31
+ databar whoami --format json # verify it works
32
+ ```
33
+
34
+ Never run `databar onboard` — that is an interactive wizard for humans, not agents.
35
+ Never run `databar login` without `--api-key` — it will hang waiting for terminal input.
36
+
37
+ ---
38
+
39
+ ## STEP 2 — Ask the user which interface they prefer
40
+
41
+ **Always ask this before starting work** (unless ~/.databar/config already contains
42
+ `preferred_interface=`):
43
+
44
+ "Databar has two interfaces:
45
+ - **CLI** — terminal commands, great for single operations, pipeable JSON output,
46
+ no code to write. Best for straightforward tasks.
47
+ - **Python SDK** — import DatabarClient, full control, required for conditional
48
+ logic (e.g. 'only enrich rows where email is verified') and multi-step pipelines
49
+ with branching.
50
+ - **Both** — use CLI for simple lookups, Python for complex workflows.
51
+
52
+ Which do you prefer? (default: CLI)"
53
+
54
+ Save their preference:
55
+
56
+ ```bash
57
+ # After they answer, append to config:
58
+ echo "preferred_interface=cli" >> ~/.databar/config # or: python, both
59
+ ```
60
+
61
+ Default to CLI if they don't answer or say they don't mind.
62
+
63
+ ---
64
+
65
+ ## STEP 3 — Set up the CLI (IMPORTANT — read carefully)
66
+
67
+ ### The PATH problem
68
+
69
+ After `pip install databar`, the `databar` binary is installed to the Python
70
+ user bin directory — but this directory is NOT on PATH by default on most systems.
71
+
72
+ **Always check this first:**
73
+
74
+ ```bash
75
+ which databar # if this prints nothing, databar is not on PATH
76
+ databar --version # if this says "command not found", fix PATH before continuing
77
+ ```
78
+
79
+ **If databar is not on PATH, fix it:**
80
+
81
+ ```bash
82
+ # Find where it's installed
83
+ python3 -m site --user-base # e.g. /Users/alice/Library/Python/3.9
84
+
85
+ # The binary is at <user-base>/bin/databar
86
+ # Add to PATH for this session:
87
+ export PATH="$(python3 -m site --user-base)/bin:$PATH"
88
+
89
+ # Verify it works now:
90
+ databar --version
91
+ ```
92
+
93
+ Tell the user to add that export line to their `~/.zshrc` or `~/.bashrc` to make
94
+ it permanent. You can offer to do it:
95
+
96
+ ```bash
97
+ echo 'export PATH="$(python3 -m site --user-base)/bin:$PATH"' >> ~/.zshrc
98
+ ```
99
+
100
+ ### CLI vs Python — when to use each
101
+
102
+ Use CLI when:
103
+ - Running a single enrichment or waterfall on known inputs
104
+ - Listing/searching enrichments, waterfalls, or tables
105
+ - Creating tables, inserting rows from CSV or JSON
106
+ - Running table enrichments
107
+ - The task is straightforward with no branching logic
108
+
109
+ Use Python SDK when:
110
+ - You need to branch on results (e.g. only process rows where a field matches)
111
+ - You're building a multi-step pipeline where step N depends on step N-1's output
112
+ - You need to loop over results and make decisions per row
113
+ - The task requires data transformation between steps
114
+
115
+ ---
116
+
117
+ ## CLI Quick Reference
118
+
119
+ All commands support `--format table|json|csv` (default: table).
120
+ **Always use `--format json` when you need to parse or pipe the output.**
121
+ The default `table` format uses Rich terminal formatting that is not machine-parseable.
122
+
123
+ ### Enrichments
124
+ ```bash
125
+ databar enrich list --format json # list all enrichments
126
+ databar enrich list --query "email verifier" --format json # search
127
+ databar enrich get <id> --format json # params + response fields
128
+ databar enrich choices <id> <param> --format json # choices for a select param
129
+ databar enrich run <id> --params '{"email": "a@b.com"}' --format json
130
+ databar enrich bulk <id> --input data.csv --out results.csv
131
+ ```
132
+
133
+ ### Waterfalls
134
+ ```bash
135
+ databar waterfall list --format json
136
+ databar waterfall get <identifier> --format json
137
+ databar waterfall run <identifier> --params '{"linkedin_url": "..."}' --format json
138
+ databar waterfall bulk <identifier> --input data.csv --out results.csv
139
+ ```
140
+
141
+ ### Tables
142
+ ```bash
143
+ databar table list --format json
144
+ databar table create --name "My Table" --columns "email,name,company"
145
+ databar table columns <table-uuid> --format json
146
+ databar table rows <table-uuid> --format json
147
+
148
+ databar table insert <table-uuid> --data '[{"email":"a@b.com"}]'
149
+ databar table insert <table-uuid> --input data.csv --allow-new-columns
150
+
151
+ databar table enrichments <table-uuid> --format json
152
+ databar table add-enrichment <table-uuid> --enrichment-id <id> --mapping '{"param": "col_name"}'
153
+ databar table run-enrichment <table-uuid> --enrichment-id <TABLE-ENRICHMENT-ID>
154
+ ```
155
+
156
+ IMPORTANT: `run-enrichment` takes the TABLE-ENRICHMENT ID (from `add-enrichment` output or
157
+ `table enrichments`), NOT the catalog enrichment ID. These are different numbers.
158
+
159
+ ### Tasks
160
+ ```bash
161
+ databar task get <task-id> --format json # check status once
162
+ databar task get <task-id> --poll # poll until complete
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Python SDK Quick Reference
168
+
169
+ ```python
170
+ from databar import DatabarClient
171
+
172
+ client = DatabarClient() # reads DATABAR_API_KEY or ~/.databar/config automatically
173
+
174
+ # Enrichments
175
+ enrichments = client.list_enrichments(q="email verifier")
176
+ enrichment = client.get_enrichment(123)
177
+ # enrichment.params[i].name → parameter slug (use as key in params dict)
178
+ # enrichment.params[i].is_required → bool
179
+ # enrichment.params[i].description → human label
180
+ # enrichment.response_fields[i].name → output field name
181
+
182
+ result = client.run_enrichment_sync(123, {"email": "alice@example.com"})
183
+ # result["data"] contains the enrichment output
184
+
185
+ # Waterfalls
186
+ waterfalls = client.list_waterfalls()
187
+ # waterfall.identifier (also .slug) → slug like "email_getter"
188
+ result = client.run_waterfall_sync("email_getter", {"linkedin_url": "..."})
189
+
190
+ # Tables
191
+ tables = client.list_tables()
192
+ # table.identifier (also .id, .uuid) → UUID string
193
+
194
+ table = client.create_table(name="Leads", columns=["email", "name"])
195
+ resp = client.get_rows(table.identifier)
196
+ # resp.data → list of row dicts keyed by column name
197
+ # resp.has_next_page → bool
198
+ # resp.total_count → int
199
+ # resp.page → int
200
+
201
+ from databar import InsertRow
202
+ client.create_rows(table.identifier, [
203
+ InsertRow(fields={"email": "alice@example.com", "name": "Alice"}),
204
+ ])
205
+ ```
206
+
207
+ ---
208
+
209
+ ## Key Concepts
210
+
211
+ - All enrichment/waterfall runs are async. The `*_sync` CLI and SDK methods handle
212
+ submit + poll automatically. For manual polling use `task get --poll` or `poll_task()`.
213
+ - `task_id` is the only task identifier. Results expire after 1 hour (status = "gone").
214
+ - Table enrichments are two steps: add (links enrichment to table) → run (triggers execution).
215
+ The ID returned by add is the TABLE-ENRICHMENT ID — different from the catalog ID.
216
+ - The SDK auto-resolves column names to UUIDs in `add_enrichment()`.
217
+
218
+ ## Model Field Aliases (Python SDK)
219
+
220
+ - `Table`: `.id`, `.uuid` → `.identifier`
221
+ - `Waterfall`: `.slug` → `.identifier`
222
+ - `EnrichmentParam`: `.slug` → `.name`, `.label` → `.description`, `.required` → `.is_required`
223
+ - `EnrichmentResponseField`: `.slug` → `.name`
224
+
225
+ ## Error Handling (Python SDK)
226
+
227
+ ```python
228
+ from databar import (
229
+ DatabarAuthError, # 401/403 — bad or missing API key
230
+ DatabarInsufficientCreditsError, # 406 — not enough credits
231
+ DatabarNotFoundError, # 404 — enrichment/table not found
232
+ DatabarTaskFailedError, # task completed with error
233
+ DatabarTimeoutError, # polling timed out
234
+ DatabarGoneError, # task data expired (>1 hour)
235
+ )
236
+ ```
237
+ """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databar
3
- Version: 2.0.6
3
+ Version: 2.0.7
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
@@ -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.6" in result.output
332
+ assert "2.0.7" in result.output
@@ -1,137 +0,0 @@
1
- """Embedded agent guide — printed by `databar agent-guide`."""
2
-
3
- AGENT_GUIDE = r"""# Databar SDK & CLI — Agent Guide
4
-
5
- Official Databar Python SDK and CLI (`pip install databar`).
6
- Run data enrichments, waterfall lookups, and manage tables via api.databar.ai/v1.
7
-
8
- ## Setup
9
-
10
- ```bash
11
- pip install databar
12
- export DATABAR_API_KEY=YOUR_API_KEY # or: databar login --api-key YOUR_API_KEY
13
- databar whoami # verify auth
14
- ```
15
-
16
- If `databar` command not found after install:
17
- ```bash
18
- export PATH="$(python3 -m site --user-base)/bin:$PATH"
19
- ```
20
-
21
- ## CLI Quick Reference
22
-
23
- All commands support `--format table|json|csv` (default: table) and `--help`.
24
- **For machine-parseable output, always use `--format json`.**
25
-
26
- ### Enrichments
27
- ```
28
- databar enrich list # list all enrichments
29
- databar enrich list --query "linkedin" # search enrichments
30
- databar enrich get <id> # get enrichment details (params, response fields)
31
- databar enrich choices <id> <param> # list choices for a select param
32
- databar enrich run <id> --params '{"key": "value"}' # run single
33
- databar enrich bulk <id> --input data.csv --out results.csv
34
- ```
35
-
36
- ### Waterfalls
37
- ```
38
- databar waterfall list
39
- databar waterfall get <identifier> # e.g. email_getter
40
- databar waterfall run <identifier> --params '{"key": "value"}'
41
- databar waterfall bulk <identifier> --input data.csv --out results.csv
42
- ```
43
-
44
- ### Tables
45
- ```
46
- databar table list
47
- databar table create --name "My Table" --columns "email,name,company"
48
- databar table columns <table-uuid>
49
- databar table rows <table-uuid>
50
- databar table rows <table-uuid> --format json
51
-
52
- databar table insert <table-uuid> --data '[{"email":"a@b.com","name":"Alice"}]'
53
- databar table insert <table-uuid> --input data.csv --allow-new-columns
54
-
55
- databar table enrichments <table-uuid>
56
- databar table add-enrichment <table-uuid> --enrichment-id <id> --mapping '{"param": "column_name"}'
57
- databar table run-enrichment <table-uuid> --enrichment-id <TABLE-ENRICHMENT-ID>
58
- ```
59
-
60
- Note: `run-enrichment` uses the TABLE-ENRICHMENT ID (from `add-enrichment` or `table enrichments`), NOT the catalog enrichment ID.
61
-
62
- ### Tasks
63
- ```
64
- databar task get <task-id> # check status once
65
- databar task get <task-id> --poll # poll until complete
66
- ```
67
-
68
- ### Account
69
- ```
70
- databar whoami
71
- databar whoami --format json
72
- ```
73
-
74
- ## Python SDK Quick Reference
75
-
76
- ```python
77
- from databar import DatabarClient
78
-
79
- client = DatabarClient() # reads DATABAR_API_KEY from env
80
-
81
- # Enrichments
82
- enrichments = client.list_enrichments(q="linkedin")
83
- enrichment = client.get_enrichment(123)
84
- # enrichment.params → list of EnrichmentParam (fields: .name, .is_required, .description)
85
- # enrichment.response_fields → list of EnrichmentResponseField (fields: .name, .type_field)
86
-
87
- result = client.run_enrichment_sync(123, {"email": "alice@example.com"})
88
-
89
- # Waterfalls
90
- waterfalls = client.list_waterfalls()
91
- # waterfall.identifier → slug like "email_getter" (also available as .slug)
92
- result = client.run_waterfall_sync("email_getter", {"linkedin_url": "..."})
93
-
94
- # Tables
95
- tables = client.list_tables()
96
- # table.identifier → UUID (also available as .id and .uuid)
97
- table = client.create_table(name="Leads", columns=["email", "name"])
98
- resp = client.get_rows(table.identifier)
99
- # resp.data → list of row dicts, resp.has_next_page, resp.total_count, resp.page
100
-
101
- from databar import InsertRow
102
- client.create_rows(table.identifier, [
103
- InsertRow(fields={"email": "alice@example.com", "name": "Alice"}),
104
- ])
105
- ```
106
-
107
- ## Key Concepts
108
-
109
- - All enrichment/waterfall runs are async: submit → get task_id → poll until completed.
110
- The `*_sync` methods handle this automatically.
111
- - task_id is the universal identifier for polling. Use it with poll_task() or `databar task get`.
112
- - Results expire after 1 hour (status becomes "gone").
113
- - Table enrichments are a two-step process: add_enrichment() then run_table_enrichment().
114
- The ID from add_enrichment is a TABLE-ENRICHMENT ID, different from the catalog enrichment ID.
115
- - The SDK auto-resolves column names to UUIDs in add_enrichment().
116
-
117
- ## Model Field Aliases
118
-
119
- Common aliases that work on all models:
120
- - Table: .id, .uuid → .identifier
121
- - Waterfall: .slug → .identifier
122
- - EnrichmentParam: .slug → .name, .label → .description, .required → .is_required
123
- - EnrichmentResponseField: .slug → .name, .label → .name
124
-
125
- ## Error Handling
126
-
127
- ```python
128
- from databar import (
129
- DatabarAuthError, # 401/403
130
- DatabarInsufficientCreditsError, # 406
131
- DatabarNotFoundError, # 404
132
- DatabarTaskFailedError, # task completed with error
133
- DatabarTimeoutError, # polling timed out
134
- DatabarGoneError, # task data expired (>1 hour)
135
- )
136
- ```
137
- """
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes