langchain.utilities.sql_database.SQLDatabase¶
class langchain.utilities.sql_database.SQLDatabase(engine: Engine, schema: Optional[str] = None, metadata: Optional[MetaData] = None, ignore_tables: Optional[List[str]] = None, include_tables: Optional[List[str]] = None, sample_rows_in_table_info: int = 3, indexes_in_table_info: bool = False, custom_table_info: Optional[dict] = None, view_support: bool = False, max_string_length: int = 300)[source]¶
SQLAlchemy wrapper around a database.
Create engine from database URI.
Attributes
dialect
Return string representation of dialect to use.
table_info
Information about all tables in the database.
Methods
__init__(engine[, schema, metadata, ...])
Create engine from database URI.
from_cnosdb([url, user, password, tenant, ...])
Class method to create an SQLDatabase instance from a CnosDB connection.
from_databricks(catalog, schema[, host, ...])
Class method to create an SQLDatabase instance from a Databricks connection.
from_uri(database_uri[, engine_args])
Construct a SQLAlchemy engine from URI.
get_table_info([table_names])
Get information about specified tables.
get_table_info_no_throw([table_names])
Get information about specified tables.
get_table_names()
Get names of tables available.
get_usable_table_names()
Get names of tables available.
run(command[, fetch])
Execute a SQL command and return a string representing the results.
run_no_throw(command[, fetch])
Execute a SQL command and return a string representing the results.