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:
Nicholas Larus-Stone
2022-11-16 22:04:50 -08:00
committed by GitHub
parent d2f9288be6
commit ca4b10bb74
2 changed files with 41 additions and 11 deletions

View File

@@ -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: