include_tables to exclude some specific column in SQLDatabase #10343
Replies: 1 comment
-
🤖 Hi, Thank you for your question. Currently, the LangChain framework does not provide a direct way to exclude specific columns when using the However, there are a couple of workarounds you could consider:
Here is the relevant part of the class SQLDatabase:
"""SQLAlchemy wrapper around a database."""
def __init__(
self,
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,
):
"""Create engine from database URI."""
...
def get_usable_table_names(self) -> Iterable[str]:
"""Get names of tables available."""
...
def get_table_info(self, table_names: Optional[List[str]] = None) -> str:
"""Get information about specified tables."""
...
def run(self, command: str, fetch: str = "all") -> str:
"""Execute a SQL command and return a string representing the results."""
... You can find the full source code for the I hope this helps! Let me know if you have any other questions. SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I know there is an option of custom table, but having said that, is there an option of excluding any specific column name in table while doing this.
db = SQLDatabase(engine, include_tables=[], sample_rows_in_table_info=5)
column where there is some sensitive info like PPI info[SSN/HICN] or password hash etc.
Beta Was this translation helpful? Give feedback.
All reactions