baucli 1.0.76__tar.gz → 1.0.78__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 (48) hide show
  1. {baucli-1.0.76 → baucli-1.0.78}/PKG-INFO +1 -1
  2. {baucli-1.0.76 → baucli-1.0.78}/baucli/__init__.py +1 -1
  3. {baucli-1.0.76 → baucli-1.0.78}/baucli/db/mssql.py +8 -2
  4. {baucli-1.0.76 → baucli-1.0.78}/baucli/db/mysql.py +7 -2
  5. {baucli-1.0.76 → baucli-1.0.78}/baucli/db/oracle.py +7 -2
  6. {baucli-1.0.76 → baucli-1.0.78}/baucli/db/postgresql.py +7 -2
  7. {baucli-1.0.76 → baucli-1.0.78}/baucli/skills.py +29 -5
  8. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/PKG-INFO +1 -1
  9. {baucli-1.0.76 → baucli-1.0.78}/setup.py +1 -1
  10. {baucli-1.0.76 → baucli-1.0.78}/MANIFEST.in +0 -0
  11. {baucli-1.0.76 → baucli-1.0.78}/README.md +0 -0
  12. {baucli-1.0.76 → baucli-1.0.78}/baucli/apex_rebuild.py +0 -0
  13. {baucli-1.0.76 → baucli-1.0.78}/baucli/apexlang.py +0 -0
  14. {baucli-1.0.76 → baucli-1.0.78}/baucli/api.py +0 -0
  15. {baucli-1.0.76 → baucli-1.0.78}/baucli/canon.py +0 -0
  16. {baucli-1.0.76 → baucli-1.0.78}/baucli/cli.py +0 -0
  17. {baucli-1.0.76 → baucli-1.0.78}/baucli/config.py +0 -0
  18. {baucli-1.0.76 → baucli-1.0.78}/baucli/db/__init__.py +0 -0
  19. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm.py +0 -0
  20. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/mssql/crm_data_mssql.sql +0 -0
  21. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/mssql/crm_demo_mssql.sql +0 -0
  22. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/mysql/crm_data_mysql.sql +0 -0
  23. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/mysql/crm_demo_mysql.sql +0 -0
  24. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/oracle/crm_demo_oracle.sql +0 -0
  25. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/postgresql/crm_data_postgresql.sql +0 -0
  26. {baucli-1.0.76 → baucli-1.0.78}/baucli/democrm_sql/postgresql/crm_demo_postgresql.sql +0 -0
  27. {baucli-1.0.76 → baucli-1.0.78}/baucli/diffenvs.py +0 -0
  28. {baucli-1.0.76 → baucli-1.0.78}/baucli/docmig.py +0 -0
  29. {baucli-1.0.76 → baucli-1.0.78}/baucli/git.py +0 -0
  30. {baucli-1.0.76 → baucli-1.0.78}/baucli/legacy/__init__.py +0 -0
  31. {baucli-1.0.76 → baucli-1.0.78}/baucli/legacy/delphi.py +0 -0
  32. {baucli-1.0.76 → baucli-1.0.78}/baucli/legacy/magic.py +0 -0
  33. {baucli-1.0.76 → baucli-1.0.78}/baucli/mcp_server.py +0 -0
  34. {baucli-1.0.76 → baucli-1.0.78}/baucli/project.py +0 -0
  35. {baucli-1.0.76 → baucli-1.0.78}/baucli/rag_embed.py +0 -0
  36. {baucli-1.0.76 → baucli-1.0.78}/baucli/sample_scan.py +0 -0
  37. {baucli-1.0.76 → baucli-1.0.78}/baucli/scope_scan.py +0 -0
  38. {baucli-1.0.76 → baucli-1.0.78}/baucli/screenshot.py +0 -0
  39. {baucli-1.0.76 → baucli-1.0.78}/baucli/seed_check.py +0 -0
  40. {baucli-1.0.76 → baucli-1.0.78}/baucli/stress.py +0 -0
  41. {baucli-1.0.76 → baucli-1.0.78}/baucli/sync.py +0 -0
  42. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/SOURCES.txt +0 -0
  43. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/dependency_links.txt +0 -0
  44. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/entry_points.txt +0 -0
  45. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/requires.txt +0 -0
  46. {baucli-1.0.76 → baucli-1.0.78}/baucli.egg-info/top_level.txt +0 -0
  47. {baucli-1.0.76 → baucli-1.0.78}/setup.cfg +0 -0
  48. {baucli-1.0.76 → baucli-1.0.78}/tests/test_canon_multiengine.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: baucli
3
- Version: 1.0.76
3
+ Version: 1.0.78
4
4
  Summary: Extracts verified business-logic and schema context from Oracle, PostgreSQL, MySQL and SQL Server
5
5
  Home-page: https://www.begcloud.com
6
6
  Author: BEG Support
@@ -3,6 +3,6 @@
3
3
  import warnings
4
4
  warnings.filterwarnings("ignore", message="urllib3 v2 only supports OpenSSL")
5
5
 
6
- __version__ = "1.0.76"
6
+ __version__ = "1.0.78"
7
7
  __product__ = "BAUCLI"
8
8
  __author__ = "BEG Support"
@@ -259,7 +259,9 @@ class MSSQLExtractor(BaseExtractor):
259
259
  ) THEN 'INDEXED VIEW'
260
260
  WHEN o.type = 'V' THEN 'VIEW'
261
261
  END AS table_type,
262
- CAST(OBJECT_DEFINITION(o.object_id) AS NVARCHAR(MAX)) AS view_source
262
+ CAST(OBJECT_DEFINITION(o.object_id) AS NVARCHAR(MAX)) AS view_source,
263
+ (SELECT SUM(p.rows) FROM sys.partitions p
264
+ WHERE p.object_id = o.object_id AND p.index_id IN (0, 1)) AS num_rows
263
265
  FROM sys.objects o
264
266
  JOIN sys.schemas s ON s.schema_id = o.schema_id
265
267
  WHERE s.name = %s
@@ -479,7 +481,7 @@ class MSSQLExtractor(BaseExtractor):
479
481
  on_progress(0, total_tbl, f"all metadata loaded, building {total_tbl} entries...")
480
482
 
481
483
  # ═══ Build results per table ═══
482
- for idx, (table_name, last_ddl, table_type, view_src) in enumerate(tables):
484
+ for idx, (table_name, last_ddl, table_type, view_src, num_rows) in enumerate(tables):
483
485
  if on_progress:
484
486
  on_progress(idx + 1, total_tbl, table_name)
485
487
 
@@ -507,6 +509,10 @@ class MSSQLExtractor(BaseExtractor):
507
509
  }
508
510
  if table_comment:
509
511
  entry["comment"] = table_comment
512
+ if num_rows is not None:
513
+ # sys.partitions (heap/clustered) = contagem de catalogo (NULL em
514
+ # views) — alimenta NUM_ROWS (estilo da LOV SELECT/COMBO/POPUP)
515
+ entry["num_rows"] = int(num_rows)
510
516
  if constraints:
511
517
  entry["constraints"] = constraints
512
518
  if view_src:
@@ -242,7 +242,8 @@ class MySQLExtractor(BaseExtractor):
242
242
  SELECT t.TABLE_NAME,
243
243
  REPLACE(CAST(COALESCE(t.UPDATE_TIME, t.CREATE_TIME) AS CHAR), ' ', 'T') AS LAST_DDL,
244
244
  t.TABLE_COMMENT,
245
- t.TABLE_TYPE
245
+ t.TABLE_TYPE,
246
+ t.TABLE_ROWS
246
247
  FROM INFORMATION_SCHEMA.TABLES t
247
248
  WHERE t.TABLE_SCHEMA = %s
248
249
  AND t.TABLE_TYPE IN ('BASE TABLE', 'VIEW')
@@ -405,7 +406,7 @@ class MySQLExtractor(BaseExtractor):
405
406
  on_progress(0, total_tbl, "building entries...")
406
407
 
407
408
  # ═══ Build results per table ═══
408
- for idx, (table_name, last_ddl, table_comment, mysql_type) in enumerate(tables):
409
+ for idx, (table_name, last_ddl, table_comment, mysql_type, num_rows) in enumerate(tables):
409
410
  if on_progress:
410
411
  on_progress(idx + 1, total_tbl, table_name)
411
412
  bau_type = 'VIEW' if mysql_type == 'VIEW' else 'TABLE'
@@ -444,6 +445,10 @@ class MySQLExtractor(BaseExtractor):
444
445
  }
445
446
  if table_comment:
446
447
  entry["comment"] = table_comment
448
+ if num_rows is not None:
449
+ # TABLE_ROWS = estimativa do otimizador (NULL em views) — alimenta
450
+ # BAU_DOCTAB_TABLES.NUM_ROWS (estilo da LOV SELECT/COMBO/POPUP)
451
+ entry["num_rows"] = int(num_rows)
447
452
  if constraints:
448
453
  entry["constraints"] = constraints
449
454
  if view_source:
@@ -913,7 +913,8 @@ class OracleExtractor(BaseExtractor):
913
913
  tc.COMMENTS AS TABLE_COMMENT,
914
914
  CASE WHEN EXISTS (SELECT 1 FROM {prefix}_MVIEWS m
915
915
  WHERE m.OWNER = o.OWNER AND m.MVIEW_NAME = o.OBJECT_NAME)
916
- THEN 'MATERIALIZED VIEW' ELSE o.OBJECT_TYPE END AS OBJECT_TYPE
916
+ THEN 'MATERIALIZED VIEW' ELSE o.OBJECT_TYPE END AS OBJECT_TYPE,
917
+ t.NUM_ROWS AS NUM_ROWS
917
918
  FROM {prefix}_OBJECTS o
918
919
  LEFT JOIN {prefix}_TABLES t ON t.OWNER = o.OWNER AND t.TABLE_NAME = o.OBJECT_NAME AND o.OBJECT_TYPE = 'TABLE'
919
920
  LEFT JOIN {prefix}_VIEWS v ON v.OWNER = o.OWNER AND v.VIEW_NAME = o.OBJECT_NAME AND o.OBJECT_TYPE = 'VIEW'
@@ -1169,7 +1170,7 @@ class OracleExtractor(BaseExtractor):
1169
1170
  on_progress(0, total_tbl, "building entries...")
1170
1171
 
1171
1172
  # ═══ Build results per table ═══
1172
- for idx, (table_name_raw, last_ddl, table_comment, obj_type) in enumerate(tables):
1173
+ for idx, (table_name_raw, last_ddl, table_comment, obj_type, num_rows) in enumerate(tables):
1173
1174
  table_name = table_name_raw or ''
1174
1175
  if not table_name:
1175
1176
  continue
@@ -1233,6 +1234,10 @@ class OracleExtractor(BaseExtractor):
1233
1234
  }
1234
1235
  if table_comment:
1235
1236
  entry["comment"] = table_comment
1237
+ if num_rows is not None:
1238
+ # NUM_ROWS das estatisticas do otimizador (dba_tables) — alimenta
1239
+ # BAU_DOCTAB_TABLES.NUM_ROWS (estilo da LOV: SELECT/COMBO/POPUP)
1240
+ entry["num_rows"] = int(num_rows)
1236
1241
  if constraints:
1237
1242
  entry["constraints"] = constraints
1238
1243
  if indexes:
@@ -286,7 +286,8 @@ class PostgreSQLExtractor(BaseExtractor):
286
286
  COALESCE(s.last_autovacuum, '1970-01-01'::timestamp)
287
287
  ), 'YYYY-MM-DD"T"HH24:MI:SS'),
288
288
  TO_CHAR(CURRENT_TIMESTAMP, 'YYYY-MM-DD"T"HH24:MI:SS')
289
- ) AS last_ddl
289
+ ) AS last_ddl,
290
+ c.reltuples AS num_rows
290
291
  FROM pg_class c
291
292
  JOIN pg_namespace n ON n.oid = c.relnamespace
292
293
  LEFT JOIN pg_description d ON d.objoid = c.oid AND d.objsubid = 0
@@ -502,7 +503,7 @@ class PostgreSQLExtractor(BaseExtractor):
502
503
  on_progress(0, total_tbl, "building entries...")
503
504
 
504
505
  # ═══ Build results per table ═══
505
- for idx, (table_name, table_comment, table_type, last_ddl) in enumerate(tables):
506
+ for idx, (table_name, table_comment, table_type, last_ddl, num_rows) in enumerate(tables):
506
507
  if on_progress:
507
508
  on_progress(idx + 1, total_tbl, table_name)
508
509
 
@@ -548,6 +549,10 @@ class PostgreSQLExtractor(BaseExtractor):
548
549
  }
549
550
  if table_comment:
550
551
  entry["comment"] = table_comment
552
+ # reltuples: estimativa do ANALYZE. -1 = nunca analisada (PG14+);
553
+ # view comum reporta 0 sem significado -> so tabela/matview.
554
+ if num_rows is not None and num_rows >= 0 and table_type != 'VIEW':
555
+ entry["num_rows"] = int(num_rows)
551
556
  if constraints:
552
557
  entry["constraints"] = constraints
553
558
  if view_source:
@@ -560,12 +560,12 @@ def _fmt_golden_rows(rows: list, kind: str) -> list:
560
560
  def _fmt_lovs(lovs: list) -> str:
561
561
  if not lovs:
562
562
  return "_Nenhuma LOV compartilhada marcada neste schema._\n"
563
- out = ["| LOV | Tabela | Retorno | Display | Ordenacao | Col. ativo |",
564
- "|---|---|---|---|---|---|"]
563
+ out = ["| LOV | Tabela | Retorno | Mascara | Display | Ordenacao | Col. ativo |",
564
+ "|---|---|---|---|---|---|---|"]
565
565
  for l in lovs:
566
566
  out.append(
567
567
  f"| `{l.get('name')}` | `{l.get('table')}` | "
568
- f"{l.get('return') or ''} | {l.get('display') or ''} | "
568
+ f"{l.get('return') or ''} | {l.get('return_mask') or ''} | {l.get('display') or ''} | "
569
569
  f"{l.get('sort') or ''} | {l.get('active_col') or ''} |")
570
570
  return "\n".join(out) + "\n"
571
571
 
@@ -908,6 +908,29 @@ Mesma regra do form aplicada ao `savedReport` default:
908
908
  - Re-rodar `PRC_BAU_DOCTAB_ORDER_COLUMNS('BAUCTX')` sempre que tabelas/colunas mudarem, ou após registrar novos domain values.
909
909
  - Overrides manuais via p4 (campos "Ordem no Report" / "Ordem no Form") sobrescrevem o cálculo até a próxima execução da procedure.
910
910
 
911
+ ## LOV compartilhada com display composto: obedeça a máscara do código
912
+
913
+ Quando o display da LOV compõe código + texto (ex.: "001 - DASS Nordeste"),
914
+ o código DEVE sair formatado pela **máscara documentada** da coluna de
915
+ retorno — o payload de `bau_lovs` (e `resolved/lovs.md`) traz `return_mask`:
916
+
917
+ ```sql
918
+ -- return_mask = '000' =>
919
+ select to_char(FIL_CODIGO, 'FM000') || ' - ' || FIL_NOME as d,
920
+ FIL_CODIGO as r
921
+ from T_FILIAL
922
+ where nvl(ATIVO,'S') <> 'N'
923
+ order by 1
924
+ ```
925
+
926
+ - Máscara numérica (`000`, `9990`…): `TO_CHAR(col, 'FM<mask>')` — o `FM`
927
+ evita o espaço de sinal à esquerda.
928
+ - **Ordenação de display COMPOSTO = a própria composição** (`order by 1`):
929
+ a lista sai na ordem do que o usuário vê ("001 - …", "002 - …"). A coluna
930
+ de *Ordenação* do `resolved/lovs.md` vale para display SIMPLES (só texto).
931
+ - Sem `return_mask`: não invente — display só com a coluna de display.
932
+ - NUNCA concatenar o código cru (`1-DASS Nordeste`) quando há máscara.
933
+
911
934
  ## Cancel em modal (obrigatório)
912
935
 
913
936
  O botão `cancel` com `action: definedByDynamicAction` precisa de uma `dynamicAction` `cancel-dialog` na mesma página que dispara `cancelDialog`:
@@ -995,12 +1018,13 @@ def build_forms_lovs_md(lovs_payload: dict, schema: str | None,
995
1018
  generated_at: str) -> str:
996
1019
  lovs = (lovs_payload or {}).get("lovs") or []
997
1020
  if lovs:
998
- rows = ["| LOV | Slug (@ referencia) | Tabela | Display | Ordenacao | Col. ativo |",
999
- "|---|---|---|---|---|---|"]
1021
+ rows = ["| LOV | Slug (@ referencia) | Tabela | Display | Mascara do cod. | Ordenacao | Col. ativo |",
1022
+ "|---|---|---|---|---|---|---|"]
1000
1023
  for l in lovs:
1001
1024
  rows.append(
1002
1025
  f"| `{l.get('name')}` | `@{_kebab(l.get('name'))}` | "
1003
1026
  f"`{l.get('table')}` | {l.get('display') or ''} | "
1027
+ f"{l.get('return_mask') or ''} | "
1004
1028
  f"{l.get('sort') or ''} | {l.get('active_col') or ''} |")
1005
1029
  body = "\n".join(rows) + "\n"
1006
1030
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: baucli
3
- Version: 1.0.76
3
+ Version: 1.0.78
4
4
  Summary: Extracts verified business-logic and schema context from Oracle, PostgreSQL, MySQL and SQL Server
5
5
  Home-page: https://www.begcloud.com
6
6
  Author: BEG Support
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="baucli",
5
- version="1.0.76",
5
+ version="1.0.78",
6
6
  description="Extracts verified business-logic and schema context from Oracle, PostgreSQL, MySQL and SQL Server",
7
7
  long_description=open("README.md").read(),
8
8
  long_description_content_type="text/markdown",
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