Skip to content

How to implement a Duckdb SQLDatabase? #20033

Answered by dosubot bot
cboettig asked this question in Q&A
Discussion options

You must be logged in to vote

The issue you're encountering with get_usable_table_names() not recognizing views and in-memory tables in LangChain's SQLDatabase class seems to stem from the handling of the view_support parameter. By default, this parameter is set to False, which means views, and potentially in-memory tables, are not included in the list of tables returned by get_usable_table_names().

To address this, you should instantiate the SQLDatabase object with view_support=True. This adjustment enables the class to recognize views and in-memory tables. Here's how you can do it:

from sqlalchemy import create_engine
from libs.community.langchain_community.utilities.sql_database import SQLDatabase

# Create an SQL…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@cboettig
Comment options

@dosubot
Comment options

Answer selected by cboettig
@cboettig
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants