Package com.hw.langchain.sql.database
Class SQLDatabase
java.lang.Object
com.hw.langchain.sql.database.SQLDatabase
SQLAlchemy wrapper around a database.
- Author:
- HamaWhite
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static SQLDatabase
Dialect will convert to lowercasegetSampleRows
(String tableName) getTableDdl
(String tableName) getTableIndexes
(String tableName) getTableInfo
(List<String> tableNames) Get information about specified tables.Get names of tables available.Execute a SQL command and return a string representing the results.
-
Constructor Details
-
SQLDatabase
-
SQLDatabase
-
-
Method Details
-
fromUri
-
getDialect
Dialect will convert to lowercase -
getUsableTableNames
Get names of tables available. -
getTableInfo
Get information about specified tables.Follows best practices as specified in: Rajkumar et al, 2022
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.
-
getTableDdl
-
getTableIndexes
-
getSampleRows
-
run
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.
-
close
public void close()
-