From c52133b554a585943d4f3f199ea0491c456435a0 Mon Sep 17 00:00:00 2001 From: wendy Date: Fri, 7 Jun 2024 11:03:29 +0800 Subject: [PATCH] translated idk.csv to bigquery --- data/idk_bigquery.csv | 106 +++++++++++++++++++++++++++++++++++++++ translate_sql_dialect.py | 11 ++-- utils/dialects.py | 4 +- 3 files changed, 115 insertions(+), 6 deletions(-) create mode 100644 data/idk_bigquery.csv diff --git a/data/idk_bigquery.csv b/data/idk_bigquery.csv new file mode 100644 index 0000000..d17666a --- /dev/null +++ b/data/idk_bigquery.csv @@ -0,0 +1,106 @@ +db_name,db_type,query_category,query,question,instructions +academic,bigquery,cat_a,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",How has technology influenced the creation and reception of contemporary art?,"Return the query 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;' if the current data doesn't permit an answer to the question." +academic,bigquery,cat_a,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;","Who wrote the dystopian novel ""1984,"" which portrays a totalitarian regime and introduces concepts like Big Brother and thoughtcrime?","If the question cannot be answered by the available data, return the query 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'" +academic,bigquery,cat_a,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",What is dark matter and what evidence supports its existence?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +academic,bigquery,cat_a,SELECT 'I\'m afraid I cannot answer that due to a lack of necessary data.' AS answer;,"In George Orwell's allegorical novella ""Animal Farm,"" what animal represents Joseph Stalin?","When the data fails to answer the question, please use the query 'SELECT 'I''m afraid I cannot answer that due to a lack of necessary data.' AS answer;'." +academic,bigquery,cat_a,SELECT 'I\'m afraid I cannot answer that due to a lack of necessary data.' AS answer;,What is the national animal of Canada?,"When the data fails to answer the question, please use the query 'SELECT 'I''m afraid I cannot answer that due to a lack of necessary data.' AS answer;'." +advising,bigquery,cat_a,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;",What role does art play in shaping cultural identity?,"When the data fails to answer the question, please use the query 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;'." +advising,bigquery,cat_a,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",What are the potential risks and benefits of outsourcing various aspects of a business operation?,"If the data at hand is inadequate for the question, respond 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +advising,bigquery,cat_a,SELECT 'I regret to inform you that I don\'t have the data needed to answer.' AS answer;,Have there been any major news events or developments today?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'I regret to inform you that I don''t have the data needed to answer.' AS answer;'." +advising,bigquery,cat_a,"SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;",Is there a meaning to suffering in life?,"If the provided data doesn't allow for an answer, please return 'SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;'." +advising,bigquery,cat_a,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,"What is the title of Harper Lee's Pulitzer Prize-winning novel, set in 1930s Alabama and exploring themes of racism and injustice?","If the question cannot be answered by the available data, return the query 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;'" +atis,bigquery,cat_a,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;",Which country has the highest population density in the world?,"When the existing data isn't enough to provide an answer, give 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'." +atis,bigquery,cat_a,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;","Which nation is known as ""The Land of Smiles""?","If the data at hand is inadequate for the question, respond 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +atis,bigquery,cat_a,"SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;",What are some potential applications of nanotechnology in medicine?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;'." +atis,bigquery,cat_a,SELECT 'I\'m afraid I cannot answer that due to a lack of necessary data.' AS answer;,Can genetic engineering be used to create crops that are resistant to pests and diseases without the need for pesticides?,Return the query 'SELECT 'I''m afraid I cannot answer that due to a lack of necessary data.' AS answer;' if the current data doesn't permit an answer to the question. +atis,bigquery,cat_a,"SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;",What are the key factors that contribute to a successful business expansion strategy?,"If the data at hand is inadequate for the question, respond 'SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;'." +geography,bigquery,cat_a,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,How do scientists determine the age of fossils and ancient artifacts?,"When the existing data isn't enough to provide an answer, give 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;'." +geography,bigquery,cat_a,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;",Which country has the longest coastline in Africa?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;'." +geography,bigquery,cat_a,"SELECT 'I must apologize, as I do not possess the needed data to answer this.' AS answer;",Can we ever truly know ourselves?,"If the provided data doesn't allow for an answer, please return 'SELECT 'I must apologize, as I do not possess the needed data to answer this.' AS answer;'." +geography,bigquery,cat_a,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",How does the use of color impact the emotional response to a piece of artwork?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +geography,bigquery,cat_a,"SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;",Has there been any significant sporting events or matches taking place today?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;'." +restaurants,bigquery,cat_a,"SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;",How can companies foster innovation and creativity within their organizational culture?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;'." +restaurants,bigquery,cat_a,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;",How can businesses effectively adapt to changing consumer preferences and market trends?,"When the data fails to answer the question, please use the query 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;'." +restaurants,bigquery,cat_a,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",Are there any important holidays or observances happening today?,"If the provided data doesn't allow for an answer, please return 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +restaurants,bigquery,cat_a,SELECT 'I regret to inform you that I don\'t have the data needed to answer.' AS answer;,Which classic novel features a character named Jay Gatsby?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'I regret to inform you that I don''t have the data needed to answer.' AS answer;'." +restaurants,bigquery,cat_a,"SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;",How does the process of photosynthesis contribute to the production of oxygen in our atmosphere?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;'." +scholar,bigquery,cat_a,SELECT 'I\'m unable to provide an answer as I lack the required information.' AS answer;,"In J.R.R. Tolkien's ""The Lord of the Rings,"" what is the name of Frodo Baggins' loyal companion?",Return the query 'SELECT 'I''m unable to provide an answer as I lack the required information.' AS answer;' if the current data doesn't permit an answer to the question. +scholar,bigquery,cat_a,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",Can art be considered a form of protest or activism?,"If the data at hand is inadequate for the question, respond 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +scholar,bigquery,cat_a,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,What is the official language of Brazil?,Return the query 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;' if the current data doesn't permit an answer to the question. +scholar,bigquery,cat_a,"SELECT 'I\'m sorry, but answering that is not feasible without the appropriate data.' AS answer;",Have there been any new scientific discoveries or breakthroughs announced today?,"If the data at hand is inadequate for the question, respond 'SELECT 'I''m sorry, but answering that is not feasible without the appropriate data.' AS answer;'." +scholar,bigquery,cat_a,"SELECT 'Regretfully, I don\'t hold the data needed to provide a response.' AS answer;",What are the ethical considerations that businesses should take into account when making strategic decisions?,"Return the query 'SELECT 'Regretfully, I don''t hold the data needed to provide a response.' AS answer;' if the current data doesn't permit an answer to the question." +yelp,bigquery,cat_a,"SELECT 'I\'m sorry, but answering that is not feasible without the appropriate data.' AS answer;",Do our actions truly define who we are as individuals?,"Return the query 'SELECT 'I''m sorry, but answering that is not feasible without the appropriate data.' AS answer;' if the current data doesn't permit an answer to the question." +yelp,bigquery,cat_a,SELECT 'I\'m afraid I cannot answer that due to a lack of necessary data.' AS answer;,What are some common techniques used in abstract art?,"If the question cannot be answered by the available data, return the query 'SELECT 'I''m afraid I cannot answer that due to a lack of necessary data.' AS answer;'" +yelp,bigquery,cat_a,"SELECT 'Regretfully, I don\'t hold the data needed to provide a response.' AS answer;",What is the purpose of life?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Regretfully, I don''t hold the data needed to provide a response.' AS answer;'." +yelp,bigquery,cat_a,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,What is the current temperature in your city?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'." +yelp,bigquery,cat_a,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;",How does one find true happiness?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;'." +academic,bigquery,cat_b,SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;,What are the key benefits of attending an international conference on renewable energy?,Return the query 'SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;' if the current data doesn't permit an answer to the question. +academic,bigquery,cat_b,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,What steps should I take to ensure a smooth transition from my undergraduate program to my graduation semester?,"If the question cannot be answered by the available data, return the query 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'" +academic,bigquery,cat_b,SELECT 'I\'m unable to provide an answer as I lack the required information.' AS answer;,How can a teacher effectively assess the individual learning needs of each student in a large classroom setting?,"If the data at hand is inadequate for the question, respond 'SELECT 'I''m unable to provide an answer as I lack the required information.' AS answer;'." +academic,bigquery,cat_b,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;",What are the current security measures in place at the international airport to ensure passenger safety?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'." +academic,bigquery,cat_b,"SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;","Who is the author of the novel ""To Kill a Mockingbird""?","If answering the question is not feasible using the available data, then please give the query 'SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;'." +advising,bigquery,cat_b,"SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;",Can you recommend a high-end seafood restaurant with ocean views in New York City?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;'." +advising,bigquery,cat_b,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,How can the quality of a dataset be assessed and improved?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'." +advising,bigquery,cat_b,"SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;",What is the current population of New York City?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Sorry, the necessary data to respond to your query is not available to me.' AS answer;'." +advising,bigquery,cat_b,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;",What are the key safety features and regulations that govern the design and operation of commercial aircraft?,"Return the query 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;' if the current data doesn't permit an answer to the question." +advising,bigquery,cat_b,"SELECT 'I\'m sorry, but answering that is not feasible without the appropriate data.' AS answer;",What are some effective tips for improving time management skills?,"Return the query 'SELECT 'I''m sorry, but answering that is not feasible without the appropriate data.' AS answer;' if the current data doesn't permit an answer to the question." +atis,bigquery,cat_b,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;",What is the maximum seating capacity of the main venue at Madison Square Garden?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'." +atis,bigquery,cat_b,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,What are the necessary steps to update my business address with the local government and ensure it is legally recognized for all official purposes?,"If the data at hand is inadequate for the question, respond 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;'." +atis,bigquery,cat_b,SELECT 'I\'m unable to provide an answer as I lack the required information.' AS answer;,How does the chemical composition of paper affect its durability and longevity?,"If the data at hand is inadequate for the question, respond 'SELECT 'I''m unable to provide an answer as I lack the required information.' AS answer;'." +atis,bigquery,cat_b,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",What is the latitude of the North Pole?,"If the data at hand is inadequate for the question, respond 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +atis,bigquery,cat_b,"SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;",What is the process for a state to secede from the United States?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;'." +geography,bigquery,cat_b,SELECT 'I regret to inform you that I don\'t have the data needed to answer.' AS answer;,What are some examples of food types that are commonly found in Mediterranean cuisine?,"If the data at hand is inadequate for the question, respond 'SELECT 'I regret to inform you that I don''t have the data needed to answer.' AS answer;'." +geography,bigquery,cat_b,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",How does daylight saving time affect the time zone difference between two locations?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +geography,bigquery,cat_b,"SELECT 'I apologize, but I\'m not equipped with the data to answer that question.' AS answer;",How do you properly format a citation for an online article with multiple authors in APA style?,"If the data at hand is inadequate for the question, respond 'SELECT 'I apologize, but I''m not equipped with the data to answer that question.' AS answer;'." +geography,bigquery,cat_b,"SELECT 'I\'m sorry, but answering that is not feasible without the appropriate data.' AS answer;",What are some popular vegetarian restaurants that offer gluten-free options in San Francisco?,"If the question cannot be answered by the available data, return the query 'SELECT 'I''m sorry, but answering that is not feasible without the appropriate data.' AS answer;'" +geography,bigquery,cat_b,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;",What are the most challenging mountains to climb in the Himalayas?,"If the question cannot be answered by the available data, return the query 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;'" +restaurants,bigquery,cat_b,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",What is the process for changing a street name in a city?,"If the data at hand is inadequate for the question, respond 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +restaurants,bigquery,cat_b,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;","In the field of medicine, what is the term for a doctor who specializes in treating diseases and disorders of the heart?","If answering the question is not feasible using the available data, then please give the query 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +restaurants,bigquery,cat_b,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",How can the credibility and impact of a scientific publication be evaluated?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +restaurants,bigquery,cat_b,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;",In which city was the first modern subway system established?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'." +restaurants,bigquery,cat_b,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",How does the elevation of a location affect its climate?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +scholar,bigquery,cat_b,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,What is the average wing span of a bald eagle?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;'." +scholar,bigquery,cat_b,SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;,How can the use of a gratitude journal impact an individual's overall well-being and mental health?,"If the provided data doesn't allow for an answer, please return 'SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;'." +scholar,bigquery,cat_b,"SELECT 'I\'m sorry, but answering that is not feasible without the appropriate data.' AS answer;",How can I improve my credit score?,"If the question cannot be answered by the available data, return the query 'SELECT 'I''m sorry, but answering that is not feasible without the appropriate data.' AS answer;'" +scholar,bigquery,cat_b,"SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;",What are the steps involved in the check-in process at a hotel?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;'." +scholar,bigquery,cat_b,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;",Which city in the United States has the highest population density?,"When the data fails to answer the question, please use the query 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +yelp,bigquery,cat_b,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;",How does the density of a substance affect its buoyancy in a fluid?,"If the question cannot be answered by the available data, return the query 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;'" +yelp,bigquery,cat_b,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;",Can you provide a detailed review of the latest smartphone model released by XYZ company?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +yelp,bigquery,cat_b,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",How many credits are required to complete a full semester at your university?,"When the existing data isn't enough to provide an answer, give 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +yelp,bigquery,cat_b,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;",Can you provide an example of a scientific study where the author cited multiple sources to support their claims?,"When the data fails to answer the question, please use the query 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;'." +yelp,bigquery,cat_b,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",What qualifications and experience should an instructor have in order to teach advanced calculus at a university level?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +academic,bigquery,cat_c,"SELECT 'Regretfully, I don\'t hold the data needed to provide a response.' AS answer;",What is the average journal impact factor of publications in the year 2020?,"If the data at hand is inadequate for the question, respond 'SELECT 'Regretfully, I don''t hold the data needed to provide a response.' AS answer;'." +academic,bigquery,cat_c,SELECT 'I regret to inform you that I don\'t have the data needed to answer.' AS answer;,"Which authors have research interests in the domain of ""Machine Learning""?",Return the query 'SELECT 'I regret to inform you that I don''t have the data needed to answer.' AS answer;' if the current data doesn't permit an answer to the question. +academic,bigquery,cat_c,SELECT 'I\'m unable to provide an answer as I lack the required information.' AS answer;,How many publications are there for each unique author email?,"If the provided data doesn't allow for an answer, please return 'SELECT 'I''m unable to provide an answer as I lack the required information.' AS answer;'." +academic,bigquery,cat_c,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,How many publications were published before the start date of the conference with `cid` 1001?,"When the data fails to answer the question, please use the query 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'." +academic,bigquery,cat_c,"SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;",How many citations does each publication with a DOI have?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;'." +advising,bigquery,cat_c,"SELECT 'Regretfully, I don\'t hold the data needed to provide a response.' AS answer;","How many students in the program ""Computer Science"" have interned at companies in the technology industry?","If answering the question is not feasible using the available data, then please give the query 'SELECT 'Regretfully, I don''t hold the data needed to provide a response.' AS answer;'." +advising,bigquery,cat_c,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",Which instructor has the most office hours scheduled?,"If the question cannot be answered by the available data, return the query 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'" +advising,bigquery,cat_c,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;","What is the average GPA of students who transferred from ""University A"" to our college?","Return the query 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;' if the current data doesn't permit an answer to the question." +advising,bigquery,cat_c,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",Which course offering has the earliest `course_assignment_deadline`?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +advising,bigquery,cat_c,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;",How many students are enrolled in courses related to their minor area of study?,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;'." +atis,bigquery,cat_c,"SELECT 'I apologize, but I\'m not equipped with the data to answer that question.' AS answer;",Which airline has the highest average cabin crew count for its flights?,"When the existing data isn't enough to provide an answer, give 'SELECT 'I apologize, but I''m not equipped with the data to answer that question.' AS answer;'." +atis,bigquery,cat_c,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,What is the average seat upgrade cost for flights departing from a particular city?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'." +atis,bigquery,cat_c,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;",How many flights have a passenger count greater than 100?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +atis,bigquery,cat_c,"SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;",What is the average baggage weight (in kilograms) for flights departing from a particular airport?,"Return the query 'SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;' if the current data doesn't permit an answer to the question." +atis,bigquery,cat_c,"SELECT 'Regrettably, I\'m without the required data to respond to that.' AS answer;",What is the average departure gate number for flights departing from each airport?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Regrettably, I''m without the required data to respond to that.' AS answer;'." +geography,bigquery,cat_c,"SELECT 'Alas, without the necessary data, I can\'t provide an answer.' AS answer;",How does the average volume of lakes vary between different countries?,"When the existing data isn't enough to provide an answer, give 'SELECT 'Alas, without the necessary data, I can''t provide an answer.' AS answer;'." +geography,bigquery,cat_c,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",How does the tourism rating of cities in a particular state compare to the overall population density of that state?,"Return the query 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;' if the current data doesn't permit an answer to the question." +geography,bigquery,cat_c,SELECT 'I\'m afraid I cannot answer that due to a lack of necessary data.' AS answer;,Which river has the fastest current speed?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'I''m afraid I cannot answer that due to a lack of necessary data.' AS answer;'." +geography,bigquery,cat_c,"SELECT 'Regretfully, I don\'t hold the data needed to provide a response.' AS answer;",How does the population growth rate of California compare to that of Texas?,"If the question cannot be answered by the available data, return the query 'SELECT 'Regretfully, I don''t hold the data needed to provide a response.' AS answer;'" +geography,bigquery,cat_c,SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;,Which mountain has the highest difficulty level for climbing?,"When the data fails to answer the question, please use the query 'SELECT 'My inability to answer stems from a lack of the necessary data.' AS answer;'." +restaurants,bigquery,cat_c,"SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;",How many restaurants in each city offer takeout services?,"If the provided data doesn't allow for an answer, please return 'SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;'." +restaurants,bigquery,cat_c,SELECT 'Answering that is beyond my capacity without the required data.' AS answer;,How many restaurants in each city have an outdoor seating area?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Answering that is beyond my capacity without the required data.' AS answer;'." +restaurants,bigquery,cat_c,"SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;","What is the average rating of restaurants that serve a menu item named ""Spicy Chicken Sandwich""?","If the question cannot be answered by the available data, return the query 'SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;'" +restaurants,bigquery,cat_c,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",How many restaurants in each city have parking options?,"Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +restaurants,bigquery,cat_c,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",How many restaurants in each region offer a food type that requires a reservation?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +scholar,bigquery,cat_c,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,"How many papers has each reviewer reviewed in the dataset named ""Research Papers 2020""?","When the data fails to answer the question, please use the query 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;'." +scholar,bigquery,cat_c,"SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;",Which papers in the database are funded by the National Science Foundation (NSF)? Please provide the title and funding agency website for each paper.,"If answering the question is not feasible using the available data, then please give the query 'SELECT 'Unfortunately, I am unable to answer due to insufficient data.' AS answer;'." +scholar,bigquery,cat_c,"SELECT 'It\'s unfortunate, but I don\'t have the information required to answer.' AS answer;",How many papers in the database have been funded by the European Research Council (ERC)?,"When the data fails to answer the question, please use the query 'SELECT 'It''s unfortunate, but I don''t have the information required to answer.' AS answer;'." +scholar,bigquery,cat_c,"SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;",How does the average research grant amount differ between papers that have been cited more than 500 times and papers that have been cited less than 100 times?,"If the provided data doesn't allow for an answer, please return 'SELECT 'Regrettably, the data required to respond is not within my reach.' AS answer;'." +scholar,bigquery,cat_c,"SELECT 'I\'m sorry, but I don\'t possess the information needed to answer that question.' AS answer;","Which authors have written papers that utilized the ""quantitative analysis"" technique mentioned in the `experimentmethodology` column?","When the data fails to answer the question, please use the query 'SELECT 'I''m sorry, but I don''t possess the information needed to answer that question.' AS answer;'." +yelp,bigquery,cat_c,"SELECT 'Sorry, I do not have the data to answer that.' AS answer;",What is the average rating of businesses with more than 100 employees?,"In the absence of sufficient data to answer the question, please produce 'SELECT 'Sorry, I do not have the data to answer that.' AS answer;'." +yelp,bigquery,cat_c,"SELECT 'I\'m sorry, but the data needed to respond to this is unavailable to me.' AS answer;",What is the average rating of businesses in neighbourhoods with a high crime rate?,"If the provided data doesn't allow for an answer, please return 'SELECT 'I''m sorry, but the data needed to respond to this is unavailable to me.' AS answer;'." +yelp,bigquery,cat_c,SELECT 'I must express my regret for not having the data to answer that.' AS answer;,How many tips were written by users who have never written a review with a rating below 3 and have a review helpfulness score above 0.5?,Return the query 'SELECT 'I must express my regret for not having the data to answer that.' AS answer;' if the current data doesn't permit an answer to the question. +yelp,bigquery,cat_c,"SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;","How many tips were given by users with the occupation ""doctor"" in the year 2020?","If the question cannot be answered by the available data, return the query 'SELECT 'My apologies, but answering that is not possible without the relevant data.' AS answer;'" +yelp,bigquery,cat_c,"SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;","How many reviews were written for businesses owned by ""Jane Doe"" in the city of ""New York""?","Should the existing data be insufficient to answer the question, revert back with the query 'SELECT 'Apologies, I lack the necessary data to provide an answer.' AS answer;'." diff --git a/translate_sql_dialect.py b/translate_sql_dialect.py index ae6ae53..b1dd2ea 100644 --- a/translate_sql_dialect.py +++ b/translate_sql_dialect.py @@ -24,17 +24,18 @@ tqdm.pandas() -dataset_file = ( - "data/instruct_advanced_postgres.csv" # Postgres dataset file to translate -) -dialect = "mysql" # Supported dialects: "bigquery", "mysql", "sqlite", "tsql" +dataset_file = "data/idk.csv" # Postgres dataset file to translate +dialect = "bigquery" # Supported dialects: "bigquery", "mysql", "sqlite", "tsql" bigquery_proj = os.getenv( "BIGQUERY_PROJ" ) # Set this to your BigQuery project ID, leave empty if dialect is not BigQuery model = "gpt-4o" # Model to use for translation of invalid SQL max_concurrent = 5 # Maximum number of concurrent coroutines when querying openai -output_file = dataset_file.replace("postgres", dialect) +if "postgres" in dataset_file: + output_file = dataset_file.replace("postgres", dialect) +else: + output_file = dataset_file.replace(".csv", f"_{dialect}.csv") df = pd.read_csv(dataset_file) diff --git a/utils/dialects.py b/utils/dialects.py index a55bec9..1fbc3c0 100644 --- a/utils/dialects.py +++ b/utils/dialects.py @@ -16,6 +16,7 @@ # Suppress all logs from sqlglot logging.getLogger("sqlglot").setLevel(logging.CRITICAL) +idk_list = list(pd.read_csv("data/idk.csv")["query"].unique()) GOOGLE_APPLICATION_CREDENTIALS = os.getenv("GOOGLE_APPLICATION_CREDENTIALS") creds = { "mysql": { @@ -279,10 +280,11 @@ def sql_to_bigquery(sql, db_type, table_metadata_string, db_name, row_idx): final_table_list = set( [table for table in sql_tables if table.lower() in table_list] ) - if final_table_list == set(): + if (final_table_list == set()) and (sql + ";" not in idk_list): print("No tables found in sql. Skipping...") print(sql) return None, None + # remove schema names if any translated = sql_remove_schema(translated, table_metadata_string) translated_test = translated