MCPcopy Create free account
hub / github.com/caesarHQ/textSQL / create_viz_data_dict

Function create_viz_data_dict

byod/client/app.py:18–35  ·  view source on GitHub ↗
(column_names, column_types, results)

Source from the content-addressed store, hash-verified

16
17
18def create_viz_data_dict(column_names, column_types, results):
19 data = {
20 "fields": [],
21 "total_rows": len(results),
22 }
23 for i, column_name in enumerate(column_names):
24 data["fields"].append({
25 "name": column_name,
26 "type": VEGA_LITE_TYPES_MAP.get(column_types[i], "nominal"),
27 })
28 for i in range(len(results)):
29 # include 1 sample
30 if i == 1:
31 break
32 r = results[i]
33 for j, column_name in enumerate(column_names):
34 data["fields"][j]["sample_value"] = r[column_name]
35 return data
36
37
38def main():

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected