mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 22:42:05 +00:00
feat: add option to ignore or restrict to SQL tables (#151)
`SQLDatabase` now accepts two `init` arguments: 1. `ignore_tables` to pass in a list of tables to not search over 2. `include_tables` to restrict to a list of tables to consider
This commit is contained in:
committed by
GitHub
parent
d2f9288be6
commit
ca4b10bb74
@@ -28,11 +28,11 @@ def test_table_info() -> None:
|
||||
db = SQLDatabase(engine)
|
||||
output = db.table_info
|
||||
expected_output = (
|
||||
"The 'company' table has columns: company_id (INTEGER), "
|
||||
"company_location (VARCHAR).\n"
|
||||
"The 'user' table has columns: user_id (INTEGER), user_name (VARCHAR(16))."
|
||||
"Table 'company' has columns: company_id (INTEGER), "
|
||||
"company_location (VARCHAR).",
|
||||
"Table 'user' has columns: user_id (INTEGER), user_name (VARCHAR(16)).",
|
||||
)
|
||||
assert output == expected_output
|
||||
assert sorted(output.split("\n")) == sorted(expected_output)
|
||||
|
||||
|
||||
def test_sql_database_run() -> None:
|
||||
|
Reference in New Issue
Block a user