feat(tableau): export Excel via DuckDB (AST->SQL) (#41)
Rewrite download_data to read filterModel/columnState from the AG Grid component and add export_dataframe (compiles filterModel to SQL via filtermodel_to_ast/ast_to_sql, builds ORDER BY, excludes hidden columns, queries DuckDB via query_marches). Replaces the old Polars filter_query pipeline tied to the removed DataTable. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+12
-1
@@ -1,4 +1,4 @@
|
||||
from src.utils.grid import fetch_grid_page, grid_column_defs
|
||||
from src.utils.grid import export_dataframe, fetch_grid_page, grid_column_defs
|
||||
|
||||
|
||||
def test_column_defs_have_field_and_filter():
|
||||
@@ -40,3 +40,14 @@ def test_fetch_grid_page_filter_reduces_count():
|
||||
def test_fetch_grid_page_offset_slicing():
|
||||
rows, _ = fetch_grid_page(None, None, 0, 5)
|
||||
assert len(rows) <= 5
|
||||
|
||||
|
||||
def test_export_dataframe_excludes_hidden_columns():
|
||||
df = export_dataframe(None, None, hidden_columns=["objet"])
|
||||
assert "objet" not in df.columns
|
||||
|
||||
|
||||
def test_export_dataframe_applies_filter():
|
||||
fm = {"objet": {"filterType": "text", "type": "contains", "filter": "zzzzzznope"}}
|
||||
df = export_dataframe(fm, None, hidden_columns=[])
|
||||
assert df.height == 0
|
||||
|
||||
+1
-1
@@ -99,7 +99,7 @@ def test_003_tableau_download(dash_duo: DashComposite):
|
||||
print(app.server.name)
|
||||
|
||||
outputs = [
|
||||
download_data(1, "", [], None),
|
||||
download_data(1, None, None),
|
||||
download_acheteur_data(1, "/acheteurs/123", "2025", "ACHETEUR 1"),
|
||||
download_titulaire_data(1, "/titulaires/345", "2025", "TITULAIRE 1"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user