Skip to content

PostgreSQL node with tool interface #206

Closed
Closed

Description

@stefann42

Problem Statement

I need to build a large SQL ETL pipeline for data preprocessing (large meaning about 5000 lines of SQL) and I'd like to work more collaboratively with coding LLMs (Claude Code, etc.). The problem with the typical IDE setup is that no matter how much schema context you provide to the LLM it will invariably hallucinate something. You have to manually take the error from your SQL execution environment and paste in the chat context and keep doing this until you eventually get the correct SQL statement and the query succeeds.

I'd like the coding LLM to run the very code it proposes against my actual PostgreSQL database so it can figure out on its own when it made an error. The output I need from the LLM is still a set of SQL statements, but ones that have been automatically validated (at least syntactically) against my actual database.

This is a code writing workflow not a reporting/data analytics task. The primary reason for running the queries is to produce the correct SQL code not to use the output.

Proposed Solution

High level solution by @ryan-t-christensen :

Wire the PostgreSQL node as a tool for an agent — the agent writes SQL, executes it against db, gets back the error (or success), and iterates until it's correct, returning the final SQL not the results. For a 5000-line ETL you can have agents be tools of other agents — an orchestrator breaks it into steps, delegates each to a worker agent with its own context window, and assembles the final script.

An agent in this case would be one of the LangChain or CrewAI nodes that would have access to an LLM and PostrgreSQL (or other agent nodes) as tools and would be able to iterate on whatever request/prompt you give it. Sometimes that means passing it a basic question or providing detailed instructions within the "settings" cog of the node. You can chain them together in really interesting/powerful ways. I can walk you through that wiring because we are also actively updating our docs to make it as intuitive as possible

Alternatives Considered

No response

Affected Modules

  • server (C++ engine)
  • client-typescript
  • client-python
  • client-mcp
  • nodes (pipeline)
  • ai
  • chat-ui
  • dropper-ui
  • vscode
  • tika

Activity

  1. added
    feature
    on Mar 7, 2026
  2. added theissue type on Mar 7, 2026
  3. added
    good first issue
    priority:high
    on Mar 7, 2026
  4. Rod-Christensen commented on Mar 7, 2026

    @Rod-Christensen
    Collaborator

    Hi Stefann,

    I coded up the basic postgres support this morning. It features a tool call interface so you can connect it to either the langchain or crewai agents.

    This is how I setup my pipeline to compare the results of crewai vs langchain:

    Image

    This gave the ability to compare both crewai and langchain on how they each handled the requests. This change is in our prerelease build, so go to RR Settings, select and Save Settings. It should download the code with this new node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

featuregood first issuepriority:high

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions