laketower 0.6.3__py3-none-any.whl → 0.6.5__py3-none-any.whl
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.
Potentially problematic release.
This version of laketower might be problematic. Click here for more details.
- laketower/__about__.py +1 -1
- laketower/cli.py +43 -4
- laketower/config.py +10 -0
- laketower/static/datatables.bundle.js +27931 -0
- laketower/static/datatables.js +55 -0
- laketower/static/vendor/datatables.net-bs5/dataTables.bootstrap5.css +610 -0
- laketower/static/vendor/datatables.net-columncontrol-bs5/columnControl.bootstrap5.min.css +1 -0
- laketower/tables.py +30 -2
- laketower/templates/_base.html +14 -2
- laketower/templates/queries/view.html +24 -2
- laketower/templates/tables/query.html +20 -4
- laketower/templates/tables/view.html +38 -38
- laketower/web.py +38 -6
- {laketower-0.6.3.dist-info → laketower-0.6.5.dist-info}/METADATA +15 -1
- {laketower-0.6.3.dist-info → laketower-0.6.5.dist-info}/RECORD +18 -14
- {laketower-0.6.3.dist-info → laketower-0.6.5.dist-info}/WHEEL +0 -0
- {laketower-0.6.3.dist-info → laketower-0.6.5.dist-info}/entry_points.txt +0 -0
- {laketower-0.6.3.dist-info → laketower-0.6.5.dist-info}/licenses/LICENSE +0 -0
laketower/__about__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.6.
|
|
1
|
+
__version__ = "0.6.5"
|
laketower/cli.py
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import argparse
|
|
2
2
|
import os
|
|
3
|
+
import time
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
import rich.jupyter
|
|
6
7
|
import rich.panel
|
|
8
|
+
import rich.style
|
|
7
9
|
import rich.table
|
|
8
10
|
import rich.text
|
|
9
11
|
import rich.tree
|
|
@@ -20,6 +22,7 @@ from laketower.tables import (
|
|
|
20
22
|
generate_table_query,
|
|
21
23
|
generate_table_statistics_query,
|
|
22
24
|
import_file_to_table,
|
|
25
|
+
limit_query,
|
|
23
26
|
load_datasets,
|
|
24
27
|
load_table,
|
|
25
28
|
)
|
|
@@ -194,9 +197,27 @@ def query_table(
|
|
|
194
197
|
query_params = {
|
|
195
198
|
name: sql_params_dict.get(name) or "" for name in query_param_names
|
|
196
199
|
}
|
|
197
|
-
|
|
200
|
+
limited_sql_query = limit_query(sql_query, config.settings.max_query_rows + 1)
|
|
198
201
|
|
|
199
|
-
|
|
202
|
+
start_time = time.perf_counter()
|
|
203
|
+
results = execute_query(
|
|
204
|
+
tables_dataset, limited_sql_query, sql_params=query_params
|
|
205
|
+
)
|
|
206
|
+
execution_time_ms = (time.perf_counter() - start_time) * 1000
|
|
207
|
+
|
|
208
|
+
truncated = results.num_rows > config.settings.max_query_rows
|
|
209
|
+
results = results.slice(
|
|
210
|
+
0, min(results.num_rows, config.settings.max_query_rows)
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
out = rich.table.Table(
|
|
214
|
+
caption=(
|
|
215
|
+
f"{results.num_rows} rows returned{' (truncated)' if truncated else ''}"
|
|
216
|
+
f"\nExecution time: {execution_time_ms:.2f}ms"
|
|
217
|
+
),
|
|
218
|
+
caption_justify="left",
|
|
219
|
+
caption_style=rich.style.Style(dim=True),
|
|
220
|
+
)
|
|
200
221
|
for column in results.column_names:
|
|
201
222
|
out.add_column(column)
|
|
202
223
|
for row_dict in results.to_pylist():
|
|
@@ -268,9 +289,27 @@ def view_query(
|
|
|
268
289
|
name: query_params_dict.get(name) or default_parameters.get(name) or ""
|
|
269
290
|
for name in sql_param_names
|
|
270
291
|
}
|
|
271
|
-
|
|
292
|
+
limited_sql_query = limit_query(sql_query, config.settings.max_query_rows + 1)
|
|
272
293
|
|
|
273
|
-
|
|
294
|
+
start_time = time.perf_counter()
|
|
295
|
+
results = execute_query(
|
|
296
|
+
tables_dataset, limited_sql_query, sql_params=sql_params
|
|
297
|
+
)
|
|
298
|
+
execution_time_ms = (time.perf_counter() - start_time) * 1000
|
|
299
|
+
|
|
300
|
+
truncated = results.num_rows > config.settings.max_query_rows
|
|
301
|
+
results = results.slice(
|
|
302
|
+
0, min(results.num_rows, config.settings.max_query_rows)
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
out = rich.table.Table(
|
|
306
|
+
caption=(
|
|
307
|
+
f"{results.num_rows} rows returned{' (truncated)' if truncated else ''}"
|
|
308
|
+
f"\nExecution time: {execution_time_ms:.2f}ms"
|
|
309
|
+
),
|
|
310
|
+
caption_justify="left",
|
|
311
|
+
caption_style=rich.style.Style(dim=True),
|
|
312
|
+
)
|
|
274
313
|
for column in results.column_names:
|
|
275
314
|
out.add_column(column)
|
|
276
315
|
for row_dict in results.to_pylist():
|
laketower/config.py
CHANGED
|
@@ -89,6 +89,15 @@ class ConfigTableConnection(pydantic.BaseModel):
|
|
|
89
89
|
return self
|
|
90
90
|
|
|
91
91
|
|
|
92
|
+
class ConfigSettingsWeb(pydantic.BaseModel):
|
|
93
|
+
hide_tables: bool = False
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class ConfigSettings(pydantic.BaseModel):
|
|
97
|
+
max_query_rows: int = 1_000
|
|
98
|
+
web: ConfigSettingsWeb = ConfigSettingsWeb()
|
|
99
|
+
|
|
100
|
+
|
|
92
101
|
class ConfigTable(pydantic.BaseModel):
|
|
93
102
|
name: str
|
|
94
103
|
uri: str
|
|
@@ -109,6 +118,7 @@ class ConfigQuery(pydantic.BaseModel):
|
|
|
109
118
|
|
|
110
119
|
|
|
111
120
|
class Config(pydantic.BaseModel):
|
|
121
|
+
settings: ConfigSettings = ConfigSettings()
|
|
112
122
|
tables: list[ConfigTable] = []
|
|
113
123
|
queries: list[ConfigQuery] = []
|
|
114
124
|
|