mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-07 07:55:13 +02:00
Fix historic SQL ingest setup and progress
This commit is contained in:
parent
f3f6b36551
commit
1bd29c7eb1
14 changed files with 877 additions and 34 deletions
|
|
@ -61,10 +61,10 @@ def _column_name(column: exp.Column) -> str:
|
|||
return str(column.name)
|
||||
|
||||
|
||||
def _columns_from_nodes(nodes: list[exp.Expression | None]) -> list[str]:
|
||||
def _columns_from_nodes(nodes: list[object]) -> list[str]:
|
||||
names: list[str] = []
|
||||
for node in nodes:
|
||||
if node is None:
|
||||
if not isinstance(node, exp.Expression):
|
||||
continue
|
||||
names.extend(_column_name(column) for column in node.find_all(exp.Column))
|
||||
return _ordered_unique(names)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
from ktx_daemon.sql_analysis import (
|
||||
AnalyzeSqlBatchItem,
|
||||
AnalyzeSqlBatchRequest,
|
||||
_columns_from_nodes,
|
||||
analyze_sql_batch_response,
|
||||
)
|
||||
|
||||
|
|
@ -51,3 +52,7 @@ def test_analyze_sql_batch_returns_per_item_parse_errors() -> None:
|
|||
assert result.tables_touched == []
|
||||
assert result.columns_by_clause == {}
|
||||
assert result.error is not None
|
||||
|
||||
|
||||
def test_columns_from_nodes_ignores_non_expression_clause_values() -> None:
|
||||
assert _columns_from_nodes([True, False, None]) == []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue