(root_dir, dataset, db_id, prompt_db="CreateTableSelect", limit_value=3, normalization=True)
| 335 | |
| 336 | |
| 337 | def generate_db_prompt_spider(root_dir, dataset, db_id, prompt_db="CreateTableSelect", limit_value=3, normalization=True): |
| 338 | DATA_PATH = root_dir |
| 339 | db_dir = f"{DATA_PATH}/{dataset}/database" |
| 340 | table_path = f"{DATA_PATH}/{dataset}/tables/tables.json" |
| 341 | table_names = None |
| 342 | |
| 343 | db_path = os.path.join(db_dir, db_id, db_id + ".sqlite") |
| 344 | if prompt_db.startswith("Table(Columns)") or prompt_db.startswith("Columns=[]"): |
| 345 | schema_prompt = extract_tablecolumn_prompt( |
| 346 | prompt_db, db_id, db_path, limit_value=limit_value, normalization=normalization) |
| 347 | elif prompt_db.startswith("CreateTable"): |
| 348 | if prompt_db.startswith("CreateTableSelectCol"): |
| 349 | schema_prompt, table_names = extract_create_table_prompt_column_example( |
| 350 | prompt_db, db_id, db_path, limit_value=limit_value, normalization=normalization) |
| 351 | else: |
| 352 | schema_prompt, table_names = extract_create_table_prompt( |
| 353 | prompt_db, db_id, db_path, limit_value=limit_value, normalization=normalization) |
| 354 | else: |
| 355 | print(prompt_db) |
| 356 | raise NotImplementedError |
| 357 | # prompt = schema_prompt + "-- Using valid SQLite, answer the following questions for the tables provided above.\n" |
| 358 | prompt = schema_prompt |
| 359 | if table_names is not None: |
| 360 | return prompt, table_names |
| 361 | return prompt |
| 362 | |
| 363 | |
| 364 | ######################################## bird schema ######################################### |
no test coverage detected