databar 2.8.0__tar.gz → 2.9.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.
- {databar-2.8.0/src/databar.egg-info → databar-2.9.0}/PKG-INFO +62 -1
- {databar-2.8.0 → databar-2.9.0}/README.md +61 -0
- {databar-2.8.0 → databar-2.9.0}/pyproject.toml +1 -1
- {databar-2.8.0 → databar-2.9.0}/src/databar/__init__.py +1 -1
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/tables.py +34 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/workbooks.py +34 -0
- {databar-2.8.0 → databar-2.9.0/src/databar.egg-info}/PKG-INFO +62 -1
- {databar-2.8.0 → databar-2.9.0}/tests/test_cli.py +73 -1
- {databar-2.8.0 → databar-2.9.0}/LICENSE +0 -0
- {databar-2.8.0 → databar-2.9.0}/setup.cfg +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/__init__.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/_auth.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/_guide.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/_oauth.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/_onboard.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/_output.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/app.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/enrichments.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/flows.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/tasks.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/cli/waterfalls.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/client.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/exceptions.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar/models.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar.egg-info/SOURCES.txt +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar.egg-info/dependency_links.txt +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar.egg-info/entry_points.txt +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar.egg-info/requires.txt +0 -0
- {databar-2.8.0 → databar-2.9.0}/src/databar.egg-info/top_level.txt +0 -0
- {databar-2.8.0 → databar-2.9.0}/tests/test_client.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/tests/test_new_features.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/tests/test_oauth_login.py +0 -0
- {databar-2.8.0 → databar-2.9.0}/tests/test_workbooks.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databar
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
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
|
|
@@ -264,6 +264,35 @@ client.upsert_rows(table.identifier, rows)
|
|
|
264
264
|
|
|
265
265
|
# Delete specific rows
|
|
266
266
|
client.delete_rows(table.identifier, ["row-uuid-1", "row-uuid-2"])
|
|
267
|
+
|
|
268
|
+
# Duplicate, clear, export, dedupe
|
|
269
|
+
copy = client.duplicate_table(table.identifier)
|
|
270
|
+
client.clear_table(table.identifier)
|
|
271
|
+
client.export_table(table.identifier, format="csv")
|
|
272
|
+
print(client.get_table_export(table.identifier).file)
|
|
273
|
+
client.dedupe_table_rows(table.identifier)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Workbooks and trash
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
workbooks = client.list_workbooks()
|
|
280
|
+
wb = client.get_workbook(workbooks[0].identifier)
|
|
281
|
+
client.rename_workbook(wb.identifier, "Q4 leads")
|
|
282
|
+
client.add_workbook_table(wb.identifier, name="Sheet 2")
|
|
283
|
+
# Set the tab order: list every sheet of the workbook exactly once
|
|
284
|
+
sheets = client.get_workbook(wb.identifier).tables
|
|
285
|
+
client.reorder_workbook_tables(wb.identifier, [s.identifier for s in reversed(sheets)])
|
|
286
|
+
client.duplicate_workbook(wb.identifier)
|
|
287
|
+
client.merge_workbooks(wb.identifier, ["wb_other"])
|
|
288
|
+
client.move_table(table.identifier, workbook=wb.identifier)
|
|
289
|
+
client.move_table(table.identifier, new_workbook=True, name="Split out")
|
|
290
|
+
client.delete_workbook(wb.identifier)
|
|
291
|
+
|
|
292
|
+
for item in client.list_trash():
|
|
293
|
+
print(item.kind, item.identifier)
|
|
294
|
+
client.restore_trash(workbooks=[wb.identifier])
|
|
295
|
+
client.purge_trash(workbooks=[wb.identifier])
|
|
267
296
|
```
|
|
268
297
|
|
|
269
298
|
### Enrichments on tables
|
|
@@ -281,6 +310,12 @@ result = client.add_enrichment(
|
|
|
281
310
|
)
|
|
282
311
|
print(f"Added enrichment #{result.id}: {result.enrichment_name}")
|
|
283
312
|
|
|
313
|
+
client.update_enrichment(
|
|
314
|
+
table.identifier,
|
|
315
|
+
result.id,
|
|
316
|
+
launch_strategy="run_on_update",
|
|
317
|
+
)
|
|
318
|
+
|
|
284
319
|
# Run it (run_strategy: run_all | run_empty | run_errors)
|
|
285
320
|
status = client.run_table_enrichment(
|
|
286
321
|
table.identifier,
|
|
@@ -518,6 +553,32 @@ databar table upsert <uuid> --key-col email --input data.csv
|
|
|
518
553
|
databar table enrichments <uuid>
|
|
519
554
|
databar table add-enrichment <uuid> --enrichment-id 123 --mapping '{"email": "email_col"}'
|
|
520
555
|
databar table run-enrichment <uuid> --enrichment-id <table-enrichment-id>
|
|
556
|
+
|
|
557
|
+
# Duplicate, clear, export, dedupe
|
|
558
|
+
databar table duplicate <uuid>
|
|
559
|
+
databar table clear <uuid>
|
|
560
|
+
databar table export <uuid> --export-format csv
|
|
561
|
+
databar table get-export <uuid>
|
|
562
|
+
databar table dedupe <uuid>
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Workbooks and trash
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
databar workbook list
|
|
569
|
+
databar workbook get <wb_id>
|
|
570
|
+
databar workbook rename <wb_id> --name "Q4 leads"
|
|
571
|
+
databar workbook duplicate <wb_id>
|
|
572
|
+
databar workbook add-table <wb_id> --name "Sheet 2"
|
|
573
|
+
databar workbook reorder <wb_id> --tables <uuid_1>,<uuid_2> # every sheet, once
|
|
574
|
+
databar workbook merge --target <wb_id> --sources <wb_a>,<wb_b>
|
|
575
|
+
databar table move <table-uuid> --workbook <wb_id>
|
|
576
|
+
databar table move <table-uuid> --new-workbook --name "Split out"
|
|
577
|
+
databar workbook delete <wb_id>
|
|
578
|
+
|
|
579
|
+
databar trash list
|
|
580
|
+
databar trash restore --workbooks <wb_id>
|
|
581
|
+
databar trash purge --workbooks <wb_id>
|
|
521
582
|
```
|
|
522
583
|
|
|
523
584
|
### Tasks
|
|
@@ -209,6 +209,35 @@ client.upsert_rows(table.identifier, rows)
|
|
|
209
209
|
|
|
210
210
|
# Delete specific rows
|
|
211
211
|
client.delete_rows(table.identifier, ["row-uuid-1", "row-uuid-2"])
|
|
212
|
+
|
|
213
|
+
# Duplicate, clear, export, dedupe
|
|
214
|
+
copy = client.duplicate_table(table.identifier)
|
|
215
|
+
client.clear_table(table.identifier)
|
|
216
|
+
client.export_table(table.identifier, format="csv")
|
|
217
|
+
print(client.get_table_export(table.identifier).file)
|
|
218
|
+
client.dedupe_table_rows(table.identifier)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Workbooks and trash
|
|
222
|
+
|
|
223
|
+
```python
|
|
224
|
+
workbooks = client.list_workbooks()
|
|
225
|
+
wb = client.get_workbook(workbooks[0].identifier)
|
|
226
|
+
client.rename_workbook(wb.identifier, "Q4 leads")
|
|
227
|
+
client.add_workbook_table(wb.identifier, name="Sheet 2")
|
|
228
|
+
# Set the tab order: list every sheet of the workbook exactly once
|
|
229
|
+
sheets = client.get_workbook(wb.identifier).tables
|
|
230
|
+
client.reorder_workbook_tables(wb.identifier, [s.identifier for s in reversed(sheets)])
|
|
231
|
+
client.duplicate_workbook(wb.identifier)
|
|
232
|
+
client.merge_workbooks(wb.identifier, ["wb_other"])
|
|
233
|
+
client.move_table(table.identifier, workbook=wb.identifier)
|
|
234
|
+
client.move_table(table.identifier, new_workbook=True, name="Split out")
|
|
235
|
+
client.delete_workbook(wb.identifier)
|
|
236
|
+
|
|
237
|
+
for item in client.list_trash():
|
|
238
|
+
print(item.kind, item.identifier)
|
|
239
|
+
client.restore_trash(workbooks=[wb.identifier])
|
|
240
|
+
client.purge_trash(workbooks=[wb.identifier])
|
|
212
241
|
```
|
|
213
242
|
|
|
214
243
|
### Enrichments on tables
|
|
@@ -226,6 +255,12 @@ result = client.add_enrichment(
|
|
|
226
255
|
)
|
|
227
256
|
print(f"Added enrichment #{result.id}: {result.enrichment_name}")
|
|
228
257
|
|
|
258
|
+
client.update_enrichment(
|
|
259
|
+
table.identifier,
|
|
260
|
+
result.id,
|
|
261
|
+
launch_strategy="run_on_update",
|
|
262
|
+
)
|
|
263
|
+
|
|
229
264
|
# Run it (run_strategy: run_all | run_empty | run_errors)
|
|
230
265
|
status = client.run_table_enrichment(
|
|
231
266
|
table.identifier,
|
|
@@ -463,6 +498,32 @@ databar table upsert <uuid> --key-col email --input data.csv
|
|
|
463
498
|
databar table enrichments <uuid>
|
|
464
499
|
databar table add-enrichment <uuid> --enrichment-id 123 --mapping '{"email": "email_col"}'
|
|
465
500
|
databar table run-enrichment <uuid> --enrichment-id <table-enrichment-id>
|
|
501
|
+
|
|
502
|
+
# Duplicate, clear, export, dedupe
|
|
503
|
+
databar table duplicate <uuid>
|
|
504
|
+
databar table clear <uuid>
|
|
505
|
+
databar table export <uuid> --export-format csv
|
|
506
|
+
databar table get-export <uuid>
|
|
507
|
+
databar table dedupe <uuid>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### Workbooks and trash
|
|
511
|
+
|
|
512
|
+
```bash
|
|
513
|
+
databar workbook list
|
|
514
|
+
databar workbook get <wb_id>
|
|
515
|
+
databar workbook rename <wb_id> --name "Q4 leads"
|
|
516
|
+
databar workbook duplicate <wb_id>
|
|
517
|
+
databar workbook add-table <wb_id> --name "Sheet 2"
|
|
518
|
+
databar workbook reorder <wb_id> --tables <uuid_1>,<uuid_2> # every sheet, once
|
|
519
|
+
databar workbook merge --target <wb_id> --sources <wb_a>,<wb_b>
|
|
520
|
+
databar table move <table-uuid> --workbook <wb_id>
|
|
521
|
+
databar table move <table-uuid> --new-workbook --name "Split out"
|
|
522
|
+
databar workbook delete <wb_id>
|
|
523
|
+
|
|
524
|
+
databar trash list
|
|
525
|
+
databar trash restore --workbooks <wb_id>
|
|
526
|
+
databar trash purge --workbooks <wb_id>
|
|
466
527
|
```
|
|
467
528
|
|
|
468
529
|
### Tasks
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "databar"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.9.0"
|
|
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" }
|
|
@@ -12,6 +12,7 @@ CLI commands for tables and rows.
|
|
|
12
12
|
databar table enrichments <uuid>
|
|
13
13
|
databar table add-enrichment <uuid> --enrichment-id <n> --mapping '{...}'
|
|
14
14
|
databar table run-enrichment <uuid> --enrichment-id <n> [--run-strategy]
|
|
15
|
+
databar table move <uuid> (--workbook <wb_id> | --new-workbook [--name])
|
|
15
16
|
"""
|
|
16
17
|
|
|
17
18
|
from __future__ import annotations
|
|
@@ -469,6 +470,39 @@ def dedupe_table(
|
|
|
469
470
|
output(result.model_dump(), fmt)
|
|
470
471
|
|
|
471
472
|
|
|
473
|
+
@app.command("move")
|
|
474
|
+
def move_table(
|
|
475
|
+
table_uuid: str = _TABLE_UUID,
|
|
476
|
+
workbook: Optional[str] = typer.Option(None, "--workbook", "-w", help="Target workbook id (wb_…)."),
|
|
477
|
+
new_workbook: bool = typer.Option(False, "--new-workbook", help="Split the sheet out into a new workbook."),
|
|
478
|
+
name: Optional[str] = typer.Option(
|
|
479
|
+
None, "--name", "-n", help="Name of the new workbook (with --new-workbook). Default: the sheet name."
|
|
480
|
+
),
|
|
481
|
+
fmt: OutputFormat = typer.Option(OutputFormat.TABLE, "--format", "--output", "-f"),
|
|
482
|
+
) -> None:
|
|
483
|
+
"""Move a sheet into another workbook, or split it out into a new one."""
|
|
484
|
+
if bool(workbook) == new_workbook:
|
|
485
|
+
error("Pass --workbook <wb_id> or --new-workbook, not both.")
|
|
486
|
+
if name is not None and not new_workbook:
|
|
487
|
+
error("--name names the new workbook; use it with --new-workbook.")
|
|
488
|
+
client = get_client()
|
|
489
|
+
try:
|
|
490
|
+
result = client.move_table(table_uuid, workbook=workbook, new_workbook=new_workbook, name=name)
|
|
491
|
+
except DatabarError as e:
|
|
492
|
+
error(e)
|
|
493
|
+
finally:
|
|
494
|
+
client.close()
|
|
495
|
+
target = result.get("workbook")
|
|
496
|
+
status = result.get("status")
|
|
497
|
+
if status == "unchanged":
|
|
498
|
+
info(f"Table is already in workbook {target}.")
|
|
499
|
+
elif status == "created":
|
|
500
|
+
success(f"Moved into new workbook {target}")
|
|
501
|
+
else:
|
|
502
|
+
success(f"Moved into workbook {target}")
|
|
503
|
+
output(result, fmt)
|
|
504
|
+
|
|
505
|
+
|
|
472
506
|
# ---------------------------------------------------------------------------
|
|
473
507
|
# Helpers
|
|
474
508
|
# ---------------------------------------------------------------------------
|
|
@@ -8,6 +8,7 @@ CLI commands for workbooks and trash.
|
|
|
8
8
|
databar workbook duplicate <id>
|
|
9
9
|
databar workbook merge --target <id> --sources id1,id2
|
|
10
10
|
databar workbook add-table <id> [--name]
|
|
11
|
+
databar workbook reorder <id> --tables uuid1,uuid2,...
|
|
11
12
|
databar trash list
|
|
12
13
|
databar trash restore --workbooks id1 [--tables uuid]
|
|
13
14
|
databar trash purge --workbooks id1 [--tables uuid]
|
|
@@ -163,6 +164,39 @@ def add_workbook_table(
|
|
|
163
164
|
success(f"Added table {table.get('identifier')}")
|
|
164
165
|
|
|
165
166
|
|
|
167
|
+
@workbook_app.command("reorder")
|
|
168
|
+
def reorder_workbook_tables(
|
|
169
|
+
workbook_id: str = typer.Argument(..., help="Workbook identifier (wb_…)."),
|
|
170
|
+
tables: str = typer.Option(
|
|
171
|
+
...,
|
|
172
|
+
"--tables",
|
|
173
|
+
"-t",
|
|
174
|
+
help="Comma-separated table UUIDs in the new order. List every sheet of the workbook exactly once.",
|
|
175
|
+
),
|
|
176
|
+
fmt: OutputFormat = typer.Option(OutputFormat.TABLE, "--format", "--output", "-f"),
|
|
177
|
+
) -> None:
|
|
178
|
+
"""Set the order of a workbook's sheets (tabs)."""
|
|
179
|
+
table_ids = [s.strip() for s in tables.split(",") if s.strip()]
|
|
180
|
+
if not table_ids:
|
|
181
|
+
error("Pass --tables with the workbook's table UUIDs in the new order.")
|
|
182
|
+
if len(set(table_ids)) != len(table_ids):
|
|
183
|
+
error("--tables lists a table more than once; list each sheet exactly once.")
|
|
184
|
+
client = get_client()
|
|
185
|
+
try:
|
|
186
|
+
wb = client.reorder_workbook_tables(workbook_id, table_ids)
|
|
187
|
+
except DatabarError as e:
|
|
188
|
+
error(e)
|
|
189
|
+
finally:
|
|
190
|
+
client.close()
|
|
191
|
+
success(f"Reordered {len(table_ids)} sheets in {wb.identifier}")
|
|
192
|
+
sheets = sorted(wb.tables, key=lambda t: t.position)
|
|
193
|
+
output(
|
|
194
|
+
[{"position": t.position, "uuid": t.identifier, "name": t.name} for t in sheets],
|
|
195
|
+
fmt,
|
|
196
|
+
table_columns=["position", "uuid", "name"],
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
166
200
|
@trash_app.command("list")
|
|
167
201
|
def list_trash(
|
|
168
202
|
fmt: OutputFormat = typer.Option(OutputFormat.TABLE, "--format", "--output", "-f"),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: databar
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.9.0
|
|
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
|
|
@@ -264,6 +264,35 @@ client.upsert_rows(table.identifier, rows)
|
|
|
264
264
|
|
|
265
265
|
# Delete specific rows
|
|
266
266
|
client.delete_rows(table.identifier, ["row-uuid-1", "row-uuid-2"])
|
|
267
|
+
|
|
268
|
+
# Duplicate, clear, export, dedupe
|
|
269
|
+
copy = client.duplicate_table(table.identifier)
|
|
270
|
+
client.clear_table(table.identifier)
|
|
271
|
+
client.export_table(table.identifier, format="csv")
|
|
272
|
+
print(client.get_table_export(table.identifier).file)
|
|
273
|
+
client.dedupe_table_rows(table.identifier)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### Workbooks and trash
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
workbooks = client.list_workbooks()
|
|
280
|
+
wb = client.get_workbook(workbooks[0].identifier)
|
|
281
|
+
client.rename_workbook(wb.identifier, "Q4 leads")
|
|
282
|
+
client.add_workbook_table(wb.identifier, name="Sheet 2")
|
|
283
|
+
# Set the tab order: list every sheet of the workbook exactly once
|
|
284
|
+
sheets = client.get_workbook(wb.identifier).tables
|
|
285
|
+
client.reorder_workbook_tables(wb.identifier, [s.identifier for s in reversed(sheets)])
|
|
286
|
+
client.duplicate_workbook(wb.identifier)
|
|
287
|
+
client.merge_workbooks(wb.identifier, ["wb_other"])
|
|
288
|
+
client.move_table(table.identifier, workbook=wb.identifier)
|
|
289
|
+
client.move_table(table.identifier, new_workbook=True, name="Split out")
|
|
290
|
+
client.delete_workbook(wb.identifier)
|
|
291
|
+
|
|
292
|
+
for item in client.list_trash():
|
|
293
|
+
print(item.kind, item.identifier)
|
|
294
|
+
client.restore_trash(workbooks=[wb.identifier])
|
|
295
|
+
client.purge_trash(workbooks=[wb.identifier])
|
|
267
296
|
```
|
|
268
297
|
|
|
269
298
|
### Enrichments on tables
|
|
@@ -281,6 +310,12 @@ result = client.add_enrichment(
|
|
|
281
310
|
)
|
|
282
311
|
print(f"Added enrichment #{result.id}: {result.enrichment_name}")
|
|
283
312
|
|
|
313
|
+
client.update_enrichment(
|
|
314
|
+
table.identifier,
|
|
315
|
+
result.id,
|
|
316
|
+
launch_strategy="run_on_update",
|
|
317
|
+
)
|
|
318
|
+
|
|
284
319
|
# Run it (run_strategy: run_all | run_empty | run_errors)
|
|
285
320
|
status = client.run_table_enrichment(
|
|
286
321
|
table.identifier,
|
|
@@ -518,6 +553,32 @@ databar table upsert <uuid> --key-col email --input data.csv
|
|
|
518
553
|
databar table enrichments <uuid>
|
|
519
554
|
databar table add-enrichment <uuid> --enrichment-id 123 --mapping '{"email": "email_col"}'
|
|
520
555
|
databar table run-enrichment <uuid> --enrichment-id <table-enrichment-id>
|
|
556
|
+
|
|
557
|
+
# Duplicate, clear, export, dedupe
|
|
558
|
+
databar table duplicate <uuid>
|
|
559
|
+
databar table clear <uuid>
|
|
560
|
+
databar table export <uuid> --export-format csv
|
|
561
|
+
databar table get-export <uuid>
|
|
562
|
+
databar table dedupe <uuid>
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
### Workbooks and trash
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
databar workbook list
|
|
569
|
+
databar workbook get <wb_id>
|
|
570
|
+
databar workbook rename <wb_id> --name "Q4 leads"
|
|
571
|
+
databar workbook duplicate <wb_id>
|
|
572
|
+
databar workbook add-table <wb_id> --name "Sheet 2"
|
|
573
|
+
databar workbook reorder <wb_id> --tables <uuid_1>,<uuid_2> # every sheet, once
|
|
574
|
+
databar workbook merge --target <wb_id> --sources <wb_a>,<wb_b>
|
|
575
|
+
databar table move <table-uuid> --workbook <wb_id>
|
|
576
|
+
databar table move <table-uuid> --new-workbook --name "Split out"
|
|
577
|
+
databar workbook delete <wb_id>
|
|
578
|
+
|
|
579
|
+
databar trash list
|
|
580
|
+
databar trash restore --workbooks <wb_id>
|
|
581
|
+
databar trash purge --workbooks <wb_id>
|
|
521
582
|
```
|
|
522
583
|
|
|
523
584
|
### Tasks
|
|
@@ -759,7 +759,7 @@ def test_task_cancel_reports_a_finished_task(monkeypatch):
|
|
|
759
759
|
def test_version_flag():
|
|
760
760
|
result = runner.invoke(app, ["--version"])
|
|
761
761
|
assert result.exit_code == 0
|
|
762
|
-
assert "2.
|
|
762
|
+
assert "2.9.0" in result.output
|
|
763
763
|
|
|
764
764
|
|
|
765
765
|
def test_output_module_does_not_import_click():
|
|
@@ -767,3 +767,75 @@ def test_output_module_does_not_import_click():
|
|
|
767
767
|
import databar.cli._output as out
|
|
768
768
|
|
|
769
769
|
assert "click" not in out.__dict__
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
# ---------------------------------------------------------------------------
|
|
773
|
+
# Workbook sheets: move / reorder
|
|
774
|
+
# ---------------------------------------------------------------------------
|
|
775
|
+
|
|
776
|
+
OTHER_UUID = "33333333-3333-3333-3333-333333333333"
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
def test_table_move_to_workbook(monkeypatch):
|
|
780
|
+
mock = _client_mock()
|
|
781
|
+
mock.move_table.return_value = {"status": "moved", "workbook": "wb_target123", "table": TABLE_UUID}
|
|
782
|
+
monkeypatch.setattr("databar.cli.tables.get_client", lambda: mock)
|
|
783
|
+
result = invoke(["table", "move", TABLE_UUID, "--workbook", "wb_target123", "--format", "json"])
|
|
784
|
+
assert result.exit_code == 0, result.output
|
|
785
|
+
assert json.loads(result.output)["data"]["workbook"] == "wb_target123"
|
|
786
|
+
mock.move_table.assert_called_once_with(TABLE_UUID, workbook="wb_target123", new_workbook=False, name=None)
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
def test_table_move_to_new_workbook_with_name(monkeypatch):
|
|
790
|
+
mock = _client_mock()
|
|
791
|
+
mock.move_table.return_value = {"status": "created", "workbook": "wb_new12345", "table": TABLE_UUID}
|
|
792
|
+
monkeypatch.setattr("databar.cli.tables.get_client", lambda: mock)
|
|
793
|
+
result = invoke(["table", "move", TABLE_UUID, "--new-workbook", "--name", "Split out"])
|
|
794
|
+
assert result.exit_code == 0, result.output
|
|
795
|
+
mock.move_table.assert_called_once_with(TABLE_UUID, workbook=None, new_workbook=True, name="Split out")
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
@pytest.mark.parametrize(
|
|
799
|
+
"args",
|
|
800
|
+
[
|
|
801
|
+
[],
|
|
802
|
+
["--workbook", "wb_target123", "--new-workbook"],
|
|
803
|
+
["--workbook", "wb_target123", "--name", "X"],
|
|
804
|
+
],
|
|
805
|
+
)
|
|
806
|
+
def test_table_move_needs_exactly_one_target(monkeypatch, args):
|
|
807
|
+
mock = _client_mock()
|
|
808
|
+
monkeypatch.setattr("databar.cli.tables.get_client", lambda: mock)
|
|
809
|
+
result = invoke(["table", "move", TABLE_UUID, *args])
|
|
810
|
+
assert result.exit_code == 2
|
|
811
|
+
mock.move_table.assert_not_called()
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
def test_workbook_reorder(monkeypatch):
|
|
815
|
+
from databar.models import Workbook
|
|
816
|
+
|
|
817
|
+
mock = _client_mock()
|
|
818
|
+
mock.reorder_workbook_tables.return_value = Workbook(
|
|
819
|
+
identifier="wb_abc12345",
|
|
820
|
+
name="Doc",
|
|
821
|
+
created_at="2026-10-30T00:00:00Z",
|
|
822
|
+
updated_at="2026-10-30T00:00:00Z",
|
|
823
|
+
tables=[
|
|
824
|
+
{"identifier": TABLE_UUID, "name": "B", "position": 1},
|
|
825
|
+
{"identifier": OTHER_UUID, "name": "A", "position": 0},
|
|
826
|
+
],
|
|
827
|
+
tables_count=2,
|
|
828
|
+
)
|
|
829
|
+
monkeypatch.setattr("databar.cli.workbooks.get_client", lambda: mock)
|
|
830
|
+
result = invoke(["workbook", "reorder", "wb_abc12345", "--tables", f"{OTHER_UUID}, {TABLE_UUID}", "--format", "json"])
|
|
831
|
+
assert result.exit_code == 0, result.output
|
|
832
|
+
mock.reorder_workbook_tables.assert_called_once_with("wb_abc12345", [OTHER_UUID, TABLE_UUID])
|
|
833
|
+
assert [t["uuid"] for t in json.loads(result.output)["data"]] == [OTHER_UUID, TABLE_UUID]
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
def test_workbook_reorder_rejects_repeats(monkeypatch):
|
|
837
|
+
mock = _client_mock()
|
|
838
|
+
monkeypatch.setattr("databar.cli.workbooks.get_client", lambda: mock)
|
|
839
|
+
result = invoke(["workbook", "reorder", "wb_abc12345", "--tables", f"{TABLE_UUID},{TABLE_UUID}"])
|
|
840
|
+
assert result.exit_code == 2
|
|
841
|
+
mock.reorder_workbook_tables.assert_not_called()
|
|
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
|
|
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
|