MCPcopy Create free account
hub / github.com/awslabs/gap-text2sql / refine_schema_names

Function refine_schema_names

rat-sql-gap/seq2struct/utils/api_utils.py:26–45  ·  view source on GitHub ↗
(schema)

Source from the content-addressed store, hash-verified

24 return new_name if new_name != "" else column_name
25
26def refine_schema_names(schema):
27 new_schema = {
28 "column_names": [],
29 "column_names_original": schema["column_names_original"],
30 "column_types": schema["column_types"],
31 "db_id": schema["db_id"],
32 "foreign_keys": schema["foreign_keys"],
33 "primary_keys": schema["primary_keys"],
34 "table_names": [],
35 "table_names_original": schema["table_names_original"],
36 }
37 for table in schema["table_names_original"]:
38 corrected = _prompt_table(table)
39 new_schema["table_names"].append(corrected)
40 for col in schema["column_names_original"]:
41 t_id = col[0]
42 column_name = col[1]
43 corrected = _prompt_column(column_name, new_schema["table_names"][t_id])
44 new_schema["column_names"].append([t_id, corrected])
45 return new_schema

Callers

nothing calls this directly

Calls 3

_prompt_tableFunction · 0.85
_prompt_columnFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected