[Python] Why does db.get_usable_table_names() not return all tables in my PostgreSQL database...

Discussão em 'Python' iniciado por Stack, Fevereiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am following langchain quick start: https://python.langchain.com/docs/use_cases/sql/quickstart/

    Below is the code snippit:

    import getpass
    import os
    from langchain_community.utilities import SQLDatabase
    from langchain.chains import create_sql_query_chain
    from langchain_openai import ChatOpenAI

    os.environ["OPENAI_API_KEY"] = getpass.getpass()
    db = SQLDatabase.from_uri("postgresql://xxx:xxx:5432/xxx")
    print("db.dialect : ", db.dialect)
    print("db.get_usable_table_names() : " , db.get_usable_table_names())


    the above is code is working, my issue is for the db.get_usable_table_names() function call, its not returning all the tables from my database.

    Do we have any inside what's the reason and how can we ensure we can get all the tables?

    Continue reading...

Compartilhe esta Página