Giter VIP home page Giter VIP logo

database-agent's Introduction

Sample Input

How many patients were hospitalized during July 2020 in Texas, and nationwide as the total of all states? Use the hospitalizedIncrease column.

Sample Output

Entering new SQL Agent Executor chain...
I need to find the total number of patients hospitalized during July 2020 from the database.
Action: sql_db_query_checker
Action Input:
SELECT SUM(hospitalized)
FROM hospital_data
WHERE date >= '2020-07-01' AND date <= '2020-07-31'
SELECT SUM(hospitalized)
FROM hospital_data
WHERE date >= '2020-07-01' AND date <= '2020-07-31';
The query looks correct, I should execute it to get the total number of patients hospitalized during July 2020.
Action: sql_db_query
Action Input:
SELECT SUM(hospitalized)
FROM hospital_data
WHERE date >= '2020-07-01' AND date <= '2020-07-31'
Error: (sqlite3.OperationalError) no such table: hospital_data
[SQL: SELECT SUM(hospitalized)
FROM hospital_data
WHERE date >= '2020-07-01' AND date <= '2020-07-31']
(Background on this error at: https://sqlalche.me/e/20/e3q8)
I need to check the schema of the database to see if the table hospital_data exists.
Action: sql_db_list_tables
Action Input: all_states_history
The table I need is not listed. I should check the schema of the database to find the correct table.
Action: sql_db_schema
Action Input: hospital_data
Error: table_names {'hospital_data'} not found in database
I need to verify the correct table names in the database.
Action: sql_db_list_tables
Action Input: all_states_history
I should use the table "all_states_history" instead of "hospital_data" to find the total number of patients hospitalized during July 2020.
Action: sql_db_query_checker
Action Input:
SELECT SUM(hospitalized)
FROM all_states_history
WHERE date >= '2020-07-01' AND date <= '2020-07-31'
SELECT SUM(hospitalized)
FROM all_states_history
WHERE date >= '2020-07-01' AND date <= '2020-07-31';
The query looks correct now. I should execute it to get the total number of patients hospitalized during July 2020.
Action: sql_db_query
Action Input:
SELECT SUM(hospitalized)
FROM all_states_history
WHERE date >= '2020-07-01' AND date <= '2020-07-31'
[(5535849.0,)]
I now know the final answer.
Final Answer: There were 5,535,849 patients hospitalized during July 2020.

Finished chain.
{'input': 'How many patients were hospitalized during July 2020', 'output': 'There were 5,535,849 patients hospitalized during July 2020.'}

Inspired From: https://learn.deeplearning.ai/accomplishments/7b4fe22d-b4fd-400f-a43e-8a49b6b1be64?usp=sharing

database-agent's People

Contributors

babayaga-mp4 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.