Duaer

集成

在 Duaer 里使用 Postgres

在 Duaer 里,Postgres 节点让工作流程直接操作 Postgres。它有 6 个操作:Delete、Execute Query、Insert、Insert or Update、Select、Update。

把 Postgres 加到 Duaer 工作流程

带示例的完整说明见 在 Duaer 里用 Postgres 读写表。

  1. 在 Duaer 画布上打开节点面板,搜索 Postgres,接在上一个节点后面。
  2. 在 Credential to connect with 里选择或新建 Postgres 凭证。见 Postgres 凭证。
  3. 选 Operation,例如 Insert or Update。
  4. 点 Execute step,查看输出。

Duaer 里 Postgres 的操作

Delete、Execute Query、Insert、Insert or Update、Select、Update。

在 Duaer 里把 Postgres 当作 AI Agent 的工具

在 AI Agent 的「工具」(Tool)输入里搜索 Postgres 并添加,由 Agent 决定什么时候调用。要让模型填写的字段,点字段旁的星形按钮,或写 $fromAI('name', '要填什么');固定值保持你设定的内容。

调用 Postgres 节点没有的接口

加一个 HTTP Request 节点,Authentication 选 Predefined Credential Type,凭证类型选 Postgres,再选同一份凭证。Duaer 会用它签名请求,你只需填方法和地址。见 自定义操作。

使用查询参数

Duaer 的 Postgres 节点用 Execute Query 时,把动态值放进 Options → Query Parameters,在 SQL 里用 $1、$2 引用。值由数据库驱动转义,比把表达式直接写进 SQL 安全。

SELECT * FROM users WHERE email = $1 AND status = $2;
-- Query Parameters: {{ $json.email }}, active

Query Parameters 用逗号分隔,每个值可以是表达式;表达式返回数组时(节点 2.5 起)展开成多个参数。

从节点 2.8 起,一个表达式给出的值即使含逗号,也只算一个参数;要给多个值,让表达式返回数组。

打开 Treat query parameters in single quotes as text 后,写在单引号里的 '$1' 按普通文本处理。

拼 IN 列表见 Postgres 常见问题。

常见问题

报错原因和修法见 Duaer 里 Postgres 的常见问题。

常见问题

Duaer 的 Postgres 节点能做什么?

在 Duaer 里,Postgres 提供 Delete、Execute Query、Insert、Insert or Update、Select、Update。

Duaer 的 Postgres 用哪种凭证?

Duaer 的 Postgres 使用 Postgres 凭证。密钥保存在凭证里,不写进节点参数。

同组