But there's some output for the last query
response = query_engine.query("Can you give me the country corresponding to each city?")
Here's the output:
Llama.generate: prefix-match hit
Querying SQL database: Can be used to translate natural language queries into SQL queries over a table containing city_stats
INFO:llama_index.query_engine.sql_join_query_engine:> Querying SQL database: Can be used to translate natural language queries into SQL queries over a table containing city_stats
> Querying SQL database: Can be used to translate natural language queries into SQL queries over a table containing city_stats
INFO:llama_index.indices.struct_store.sql_query:> Table desc str: Table 'city_stats' has columns: city_name (VARCHAR(16)), population (INTEGER), country (VARCHAR(16)), and foreign keys: .
> Table desc str: Table 'city_stats' has columns: city_name (VARCHAR(16)), population (INTEGER), country (VARCHAR(16)), and foreign keys: .
llama_print_timings: load time = 128847.69 ms
llama_print_timings: sample time = 148.87 ms / 177 runs ( 0.84 ms per token, 1188.96 tokens per second)
llama_print_timings: prompt eval time = 82293.66 ms / 279 tokens ( 294.96 ms per token, 3.39 tokens per second)
llama_print_timings: eval time = 52739.85 ms / 176 runs ( 299.66 ms per token, 3.34 tokens per second)
llama_print_timings: total time = 135561.23 ms
Llama.generate: prefix-match hit
llama_print_timings: load time = 128847.69 ms
llama_print_timings: sample time = 54.47 ms / 66 runs ( 0.83 ms per token, 1211.61 tokens per second)
llama_print_timings: prompt eval time = 70320.81 ms / 230 tokens ( 305.74 ms per token, 3.27 tokens per second)
llama_print_timings: eval time = 18608.56 ms / 65 runs ( 286.29 ms per token, 3.49 tokens per second)
llama_print_timings: total time = 89121.04 ms
Then the error:
OperationalError Traceback (most recent call last)
File ./venv/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1965, in Connection._exec_single_context(self, dialect, context, statement, parameters)
1964 if not evt_handled:
-> 1965 self.dialect.do_execute(
1966 cursor, str_statement, effective_parameters, context
1967 )
1969 if self._has_events or self.engine._has_events:
File ./venv/lib/python3.8/site-packages/sqlalchemy/engine/default.py:921, in DefaultDialect.do_execute(self, cursor, statement, parameters, context)
920 def do_execute(self, cursor, statement, parameters, context=None):
--> 921 cursor.execute(statement, parameters)
OperationalError: near "Sure": syntax error
The above exception was the direct cause of the following exception:
OperationalError Traceback (most recent call last)
./SQLAutoVectorQueryEngine.ipynb Cell 35 line 1
----> 1 response = query_engine.query("Can you give me the country corresponding to each city?")
File ./venv/lib/python3.8/site-packages/llama_index/indices/query/base.py:23, in BaseQueryEngine.query(self, str_or_query_bundle)
21 if isinstance(str_or_query_bundle, str):
22 str_or_query_bundle = QueryBundle(str_or_query_bundle)
---> 23 response = self._query(str_or_query_bundle)
...
SQLQuery: SELECT country FROM city_stats WHERE city_name = ?
Please provide the city name as a parameter. I'll wait for your response before running the query.]
(Background on this error at: https://sqlalche.me/e/20/e3q8)