data-ops-cli 0.3.5__tar.gz → 0.3.6__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 (35) hide show
  1. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/PKG-INFO +2 -2
  2. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/pyproject.toml +1 -1
  3. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/PKG-INFO +2 -2
  4. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/requires.txt +1 -1
  5. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/__init__.py +1 -1
  6. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/data_table.py +14 -13
  7. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/table.py +37 -27
  8. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/setup.cfg +0 -0
  9. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/SOURCES.txt +0 -0
  10. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/dependency_links.txt +0 -0
  11. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/entry_points.txt +0 -0
  12. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/data_ops_cli.egg-info/top_level.txt +0 -0
  13. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/_compat.py +0 -0
  14. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/__init__.py +0 -0
  15. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/alarm.py +0 -0
  16. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/api.py +0 -0
  17. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/auth.py +0 -0
  18. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/dataset.py +0 -0
  19. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/datasource.py +0 -0
  20. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/dict_.py +0 -0
  21. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/factory.py +0 -0
  22. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/hazard.py +0 -0
  23. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/metrics.py +0 -0
  24. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/ref.py +0 -0
  25. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/report.py +0 -0
  26. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/skill.py +0 -0
  27. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/utils.py +0 -0
  28. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/widget.py +0 -0
  29. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/cli/workflow.py +0 -0
  30. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/exceptions.py +0 -0
  31. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/runner.py +0 -0
  32. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/schems.py +0 -0
  33. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/sdk.py +0 -0
  34. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/session.py +0 -0
  35. {data_ops_cli-0.3.5 → data_ops_cli-0.3.6}/src/dataops_cli/utils.py +0 -0
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: data-ops-cli
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Command-line wrapper around dataops_sdk for the DataOps platform.
5
5
  Requires-Python: >=3.11
6
- Requires-Dist: dataops-sdk[runner]>=0.3.4
6
+ Requires-Dist: dataops-sdk[runner]>=0.3.6
7
7
  Requires-Dist: typer
8
8
  Requires-Dist: rich
9
9
  Provides-Extra: dev
@@ -8,7 +8,7 @@ dynamic = ["version"]
8
8
  description = "Command-line wrapper around dataops_sdk for the DataOps platform."
9
9
  requires-python = ">=3.11"
10
10
  dependencies = [
11
- "dataops-sdk[runner]>=0.3.4",
11
+ "dataops-sdk[runner]>=0.3.6",
12
12
  "typer",
13
13
  "rich",
14
14
  ]
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: data-ops-cli
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Command-line wrapper around dataops_sdk for the DataOps platform.
5
5
  Requires-Python: >=3.11
6
- Requires-Dist: dataops-sdk[runner]>=0.3.4
6
+ Requires-Dist: dataops-sdk[runner]>=0.3.6
7
7
  Requires-Dist: typer
8
8
  Requires-Dist: rich
9
9
  Provides-Extra: dev
@@ -1,4 +1,4 @@
1
- dataops-sdk[runner]>=0.3.4
1
+ dataops-sdk[runner]>=0.3.6
2
2
  typer
3
3
  rich
4
4
 
@@ -14,4 +14,4 @@ groups command modules under :mod:`dataops_cli.cli` and re-exports the package
14
14
  removed in ``dataops_cli`` 1.0.
15
15
  """
16
16
 
17
- __version__ = "0.3.5"
17
+ __version__ = "0.3.6"
@@ -68,8 +68,8 @@ def list_datatable(
68
68
  group_nodes = filter_nodes_by_pattern(group_nodes, query, include_digest=True)
69
69
 
70
70
  print_list(
71
- ["code", "title", "remark"],
72
- [[column.code, column.title, column.remark] for column in group_nodes],
71
+ ["code", "name", "title", "remark"],
72
+ [[column.code, column.name, column.title, column.remark or ""] for column in group_nodes],
73
73
  )
74
74
 
75
75
 
@@ -106,23 +106,17 @@ def get_datatable_detail(
106
106
  typer.echo("错误: 未找到多维表格")
107
107
  raise typer.Exit(code=1) from None
108
108
 
109
- table = Table("field", "value", show_header=False)
110
- table.add_row("datasource", meta.data.model.datasource)
111
- table.add_row("引用类型", meta.data.model.ref_type)
112
- table.add_row("引用编码", meta.data.model.ref_code)
113
- table.add_row("引用表名", meta.data.model.table_name)
114
-
115
- console = Console(no_color=True)
116
- console.print(table)
109
+ print("ref-datasource ref-type ref-code ref-table-name")
110
+ print(meta.data.model.datasource, meta.data.model.ref_type, meta.data.model.ref_code, meta.data.model.table_name)
111
+ print()
117
112
 
118
113
  print_list(
119
- ["column(visable)", "type", "title", "visible"],
114
+ ["column(visable)", "type", "title"],
120
115
  [
121
116
  [
122
117
  field.name + f"({'√' if field.visible else 'x'})",
123
118
  field.type,
124
119
  field.title,
125
- field.visible,
126
120
  ]
127
121
  for field in meta.data.fields
128
122
  ],
@@ -260,8 +254,15 @@ def get_datatable_data(
260
254
  query_param: 可选 SqlQueryParam JSON。
261
255
 
262
256
  Examples:
263
- >>> data-ops-cli data_table data dt_code_001
257
+ 通过多为表格编码查询数据
258
+ >>> data-ops-cli data_table data <code>
259
+ 通过数据源和表名查询数据
260
+ >>> data-ops-cli data_table data <datasource> <name>
264
261
  """
262
+ if not name and not arg1.replace("_", "").replace("-", "").isnumeric():
263
+ print("输入参数错误 using `table detail <code>` or `table detail <datasource> <name>`")
264
+ raise typer.Exit(code=1) from None
265
+
265
266
  pp = PageParam(start=page_num * page_size, limit=page_size)
266
267
  qp = SqlQueryParam.model_validate_json(query_param) if query_param else SqlQueryParam()
267
268
 
@@ -111,6 +111,9 @@ def get_table_detail(
111
111
  # 显示完整的DDL信息(含关联字段)
112
112
  >>> data-ops-cli table detail mydatasource t_user --full
113
113
  """
114
+ if not name and not arg1.replace("_", "").replace("-", "").isnumeric():
115
+ print("输入参数错误 using `table detail <code>` or `table detail <datasource> <name>`")
116
+ raise typer.Exit(code=1) from None
114
117
  try:
115
118
  meta = (
116
119
  service_get_table_detail_by_name(arg1, name)
@@ -123,7 +126,11 @@ def get_table_detail(
123
126
 
124
127
  datasource = meta.subSystem
125
128
 
126
- print(datasource, meta.name)
129
+ assert meta.data, "元数据不存在"
130
+
131
+ print("datasource name code remark")
132
+ print(datasource, meta.name, meta.code, meta.remark or "")
133
+ print()
127
134
 
128
135
  def show_column(column: ColumnItem):
129
136
  if column.pk and column.labelKey:
@@ -205,6 +212,9 @@ def count_table_by_code(
205
212
  带查询条件统计数量
206
213
  >>> data-ops-cli table count mydatasource t_user --query '{"where":"status=1"}'
207
214
  """
215
+ if not name and not arg1.replace("_", "").replace("-", "").isnumeric():
216
+ print("输入参数错误 using `table detail <code>` or `table detail <datasource> <name>`")
217
+ raise typer.Exit(code=1) from None
208
218
  qp = SqlQueryParam.model_validate_json(query_param) if query_param else None
209
219
  try:
210
220
  count = (
@@ -228,14 +238,7 @@ def get_table_data(
228
238
  str | None, typer.Option("--query", "-q", help="查询参数(SqlQueryParam)")
229
239
  ] = None,
230
240
  ) -> None:
231
- """获取表的实际数据内容。
232
-
233
- 支持两种查询方式:
234
-
235
- 1. 通过表编码(CODE)直接查询
236
- 2. 通过数据源名称和表名组合查询
237
-
238
- 支持分页参数 ``-n/--page-num``、``-s/--page-size``,以及 ``--query/-q`` 条件过滤。
241
+ """获取表的实际数据内容。s
239
242
 
240
243
  Args:
241
244
  arg1: 表编码;当同时提供 ``name`` 时为数据源名称。
@@ -257,6 +260,10 @@ def get_table_data(
257
260
  # 带条件过滤查询
258
261
  >>> data-ops-cli table data mydatasource t_user --query '{"where":"status=1"}'
259
262
  """
263
+ if not name and not arg1.replace("_", "").replace("-", "").isnumeric():
264
+ print("输入参数错误 using `table detail <code>` or `table detail <datasource> <name>`")
265
+ raise typer.Exit(code=1) from None
266
+
260
267
  pp = PageParam(start=page_num * page_size, limit=page_size)
261
268
  qp = SqlQueryParam.model_validate_json(query_param) if query_param else SqlQueryParam()
262
269
  try:
@@ -319,13 +326,12 @@ def exec_sql(
319
326
  @column_typer.command("base", no_args_is_help=True)
320
327
  def set_column_config(
321
328
  datasource: Annotated[str, typer.Argument(help="编数据源")],
322
- name: Annotated[str | None, typer.Argument(help="表名")],
323
- column: Annotated[str, typer.Argument(help="列名")],
329
+ name: Annotated[str, typer.Argument(help="表名")],
330
+ column_name: Annotated[str, typer.Argument(help="列名")],
324
331
  title: Annotated[str | None, typer.Option(help="中文名称")] = None,
325
332
  pk: Annotated[bool | None, typer.Option(help="主键")] = None,
326
333
  nullable: Annotated[bool | None, typer.Option(help="是否可为空")] = None,
327
334
  labelKey: Annotated[bool | None, typer.Option(help="名称键")] = None,
328
- remark: Annotated[str | None, typer.Option(help="备注")] = None,
329
335
  ) -> None:
330
336
  """修改列基础配置。
331
337
 
@@ -337,10 +343,10 @@ def set_column_config(
337
343
  pk: 可选主键标记。
338
344
  nullable: 可空标记。
339
345
  labelKey: 可选名称键标记。
340
- remark: 可选备注。
341
346
  """
342
347
  meta = service_get_table_detail_by_name(datasource, name)
343
- column = next(filter(lambda c: c.name == column, meta.data.columns))
348
+ assert meta.data, f"表 {name} 元数据不存在"
349
+ column = next(filter(lambda c: c.name == column_name, meta.data.columns))
344
350
  if title:
345
351
  column.title = title
346
352
  if pk is not None:
@@ -349,18 +355,16 @@ def set_column_config(
349
355
  column.nullable = nullable
350
356
  if labelKey:
351
357
  column.labelKey = labelKey
352
- if remark:
353
- column.remark = remark
354
358
  result = release_list_update(meta)
355
359
  typer.echo(f"修改 {datasource} {name} {column.name} 完成")
356
360
 
357
361
 
358
362
  @column_typer.command("dict", no_args_is_help=True)
359
- def set_column_dict_config(
363
+ def get_column_dict_config(
360
364
  datasource: Annotated[str, typer.Argument(help="编数据源")],
361
- name: Annotated[str | None, typer.Argument(help="表名")],
362
- column: Annotated[str, typer.Argument(help="列名")],
363
- dict_name: Annotated[str, typer.Option("--dict", help="字典名称")] = None,
365
+ name: Annotated[str, typer.Argument(help="表名")],
366
+ column_name: Annotated[str, typer.Argument(help="列名")],
367
+ dict_name: Annotated[str, typer.Option("--dict", help="字典名称")],
364
368
  ) -> None:
365
369
  """设置列字典关系配置。
366
370
 
@@ -371,21 +375,23 @@ def set_column_dict_config(
371
375
  dict_name: 字典名称。
372
376
  """
373
377
  table_meta = service_get_table_detail_by_name(datasource, name)
374
- column_item = next(filter(lambda c: c.name == column, table_meta.data.columns))
378
+ assert table_meta.data, f"表 {name} 元数据不存在"
379
+ column_item = next(filter(lambda c: c.name == column_name, table_meta.data.columns), None)
380
+ assert column_item, f"列 {column_name} 不存在"
375
381
  dict_meta = service_get_dict_detail_by_name(datasource, dict_name)
376
382
  column_item.type = "dict"
377
383
  column_item.typeExt = DataBaseColumnDictExternal(
378
384
  ref__dict=DataBaseColumnReference(type="dict", code=dict_meta.code)
379
385
  )
380
386
  result = release_list_update(table_meta)
381
- typer.echo(f"修改 {datasource} {name} {column.name} 完成")
387
+ typer.echo(f"修改 {datasource} {name} {column_item.name} 完成")
382
388
 
383
389
 
384
390
  @column_typer.command("relation", no_args_is_help=True)
385
391
  def set_column_dict_config(
386
392
  datasource: Annotated[str, typer.Argument(help="编数据源")],
387
- name: Annotated[str | None, typer.Argument(help="表名")],
388
- column: Annotated[str, typer.Argument(help="列名")],
393
+ name: Annotated[str, typer.Argument(help="表名")],
394
+ column_name: Annotated[str, typer.Argument(help="列名")],
389
395
  r_name: Annotated[str, typer.Option(help="目标表名")] = None,
390
396
  r_col_name: Annotated[str, typer.Option(help="目标列名")] = None,
391
397
  ) -> None:
@@ -399,9 +405,13 @@ def set_column_dict_config(
399
405
  r_col_name: 目标列名。
400
406
  """
401
407
  table_meta = service_get_table_detail_by_name(datasource, name)
402
- column_item = next(filter(lambda c: c.name == column, table_meta.data.columns))
408
+ assert table_meta.data, f"表 {name} 元数据不存在"
409
+ column_item = next(filter(lambda c: c.name == column_name, table_meta.data.columns), None)
410
+ assert column_item, f"列 {column_name} 不存在"
403
411
  dst_table_meta = service_get_table_detail_by_name(datasource, r_name)
404
- dst_column_item = next(filter(lambda c: c.name == r_col_name, dst_table_meta.data.columns))
412
+ dst_column_item = next(filter(lambda c: c.name == r_col_name, dst_table_meta.data.columns), None)
413
+ assert dst_column_item, f"列 {r_col_name} 不存在"
414
+
405
415
  column_item.type = "relation"
406
416
  column_item.typeExt = DataBaseColumnTableExternal(
407
417
  ref__table=DataBaseColumnReference(type="table", code=dst_table_meta.code),
@@ -410,4 +420,4 @@ def set_column_dict_config(
410
420
  ),
411
421
  )
412
422
  result = release_list_update(table_meta)
413
- typer.echo(f"修改 {datasource} {name} {column.name} 完成")
423
+ typer.echo(f"修改 {datasource} {name} {column_item.name} 完成")
File without changes