LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    MCP Adapters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-classicchainssql_databasequery
    Module●Since v1.0

    query

    Attributes

    attribute
    PROMPT
    attribute
    SQL_PROMPTS: dict

    Functions

    function
    create_sql_query_chain

    Create a chain that generates SQL queries.

    Security Note: This chain generates SQL queries for the given database.

    The SQLDatabase class provides a get_table_info method that can be used
    to get column information as well as sample data from the table.
    
    To mitigate risk of leaking sensitive data, limit permissions
    to read and scope to the tables that are needed.
    
    Optionally, use the SQLInputWithTables input type to specify which tables
    are allowed to be accessed.
    
    Control access to who can submit requests to this chain.
    
    See https://docs.langchain.com/oss/python/security-policy for more information.
    

    Classes

    class
    SQLInput

    Input for a SQL Chain.

    class
    SQLInputWithTables

    Input for a SQL Chain.

    View source on GitHub