(https://arxiv.org/abs/2204.00498)
If sample_rows_in_table_info, the specified number of sample rows will be
appended to each table description. This can increase performance as
demonstrated in the paper.
get_table_names() → Iterable[str][source]¶
Get names of tables available.
get_usable_table_names() → Iterable[str][source]¶
Get names of tables available.
run(command: str, fetch: str = 'all') → str[source]¶
Execute a SQL command and return a string representing the results.
If the statement returns rows, a string of the results is returned.
If the statement returns no rows, an empty string is returned.
run_no_throw(command: str, fetch: str = 'all') → str[source]¶
Execute a SQL command and return a string representing the results.
If the statement returns rows, a string of the results is returned.
If the statement returns no rows, an empty string is returned.
If the statement throws an error, the error message is returned.
Examples using SQLDatabase¶
Rebuff
SQL Database
Multiple Retrieval Sources
Set env var OPENAI_API_KEY or load from a .env file
Vector SQL Retriever with MyScale
SQL
sql_db.md