PostgreSQL 데이터베이스와 대화
중급
이것은Engineering, Product, AI, IT Ops분야의자동화 워크플로우로, 11개의 노드를 포함합니다.주로 PostgresTool, Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 등의 노드를 사용하며인공지능 기술을 결합하여 스마트 자동화를 구현합니다. PostgreSQL 데이터베이스와 대화합니다.
사전 요구사항
- •PostgreSQL 데이터베이스 연결 정보
- •OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
"id": "eOUewYsEzJmQixI6",
"meta": {
"instanceId": "77c4feba8f41570ef06dc76ece9a6ded0f0d44f7f1477a64c2d71a8508c11faa",
"templateCredsSetupCompleted": true
},
"name": "Chat with Postgresql Database",
"tags": [],
"nodes": [
{
"id": "6501a54f-a68c-452d-b353-d7e871ca3780",
"name": "채팅 메시지 수신 시",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-300,
-80
],
"webhookId": "cf1de04f-3e38-426c-89f0-3bdb110a5dcf",
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"name": "AI 에이전트",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
0,
-80
],
"parameters": {
"agent": "openAiFunctionsAgent",
"options": {
"systemMessage": "You are DB assistant. You need to run queries in DB aligned with user requests.\n\nRun custom SQL query to aggregate data and response to user. Make sure every table has schema prefix to it in sql query which you can get from `Get DB Schema and Tables List` tool.\n\nFetch all data to analyse it for response if needed.\n\n## Tools\n\n- Execute SQL query - Executes any sql query generated by AI\n- Get DB Schema and Tables List - Lists all the tables in database with its schema name\n- Get Table Definition - Gets the table definition from db using table name and schema name"
}
},
"typeVersion": 1.7
},
{
"id": "8accbeeb-7eaf-4e9e-aabc-de8ab3a0459b",
"name": "OpenAI 채팅 모델",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-60,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "48uG61Ilo8jndw3r",
"name": "Your OpenAI Account Credentials"
}
},
"typeVersion": 1.2
},
{
"id": "11f2013f-a080-4c9e-8773-c90492e2c628",
"name": "테이블 정의 가져오기",
"type": "n8n-nodes-base.postgresTool",
"position": [
780,
140
],
"parameters": {
"query": "select\n c.column_name,\n c.data_type,\n c.is_nullable,\n c.column_default,\n tc.constraint_type,\n ccu.table_name AS referenced_table,\n ccu.column_name AS referenced_column\nfrom\n information_schema.columns c\nLEFT join\n information_schema.key_column_usage kcu\n ON c.table_name = kcu.table_name\n AND c.column_name = kcu.column_name\nLEFT join\n information_schema.table_constraints tc\n ON kcu.constraint_name = tc.constraint_name\n AND tc.constraint_type = 'FOREIGN KEY'\nLEFT join\n information_schema.constraint_column_usage ccu\n ON tc.constraint_name = ccu.constraint_name\nwhere\n c.table_name = '{{ $fromAI(\"table_name\") }}'\n AND c.table_schema = '{{ $fromAI(\"schema_name\") }}'\norder by\n c.ordinal_position",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get table definition to find all columns and types"
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
},
{
"id": "760bc9bc-0057-4088-b3f0-3ee37b3519df",
"name": "스티커 노트",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-240
],
"parameters": {
"color": 5,
"width": 560,
"height": 120,
"content": "### 👨🎤 Setup\n1. Add your **postgresql** and **OpenAI** credentials.\n2. Click **Chat** button and start asking questions to your database.\n3. Activate the workflow and you can make the chat publicly available."
},
"typeVersion": 1
},
{
"id": "0df33341-c859-4a54-b6d9-a99670e8d76d",
"name": "채팅 기록",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
120,
160
],
"parameters": {},
"typeVersion": 1.3
},
{
"id": "4938b22e-f187-4ca0-b9f1-60835e823799",
"name": "스티커 노트3",
"type": "n8n-nodes-base.stickyNote",
"position": [
360,
300
],
"parameters": {
"color": 7,
"width": 562,
"height": 156,
"content": "🛠️ Tools Used:\n1. Execute SQL Query: Used to execute any query generated by the agent.\n2. Get DB Schema and Tables List: It returns the list of all the tables with its schema name.\n3. Get Table Definition: It returns table details like column names, foreign keys and more of a particular table in a schema."
},
"typeVersion": 1
},
{
"id": "39780c78-4fbc-403e-a220-aa6a4b06df8c",
"name": "스티커 노트1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-100,
300
],
"parameters": {
"color": 7,
"width": 162,
"height": 99,
"content": "👆 You can exchange this with any other chat model of your choice."
},
"typeVersion": 1
},
{
"id": "28a5692c-5003-46cb-9a09-b7867734f446",
"name": "스티커 노트2",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
300
],
"parameters": {
"color": 7,
"width": 162,
"height": 159,
"content": "👆 You can change how many number of messages to keep using `Context Window Length` option. It's 5 by default."
},
"typeVersion": 1
},
{
"id": "c18ced71-6330-4ba0-9c52-1bb5852b3039",
"name": "SQL 쿼리 실행",
"type": "n8n-nodes-base.postgresTool",
"position": [
380,
140
],
"parameters": {
"query": "{{ $fromAI(\"sql_query\", \"SQL Query\") }}",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get all the data from Postgres, make sure you append the tables with correct schema. Every table is associated with some schema in the database."
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
},
{
"id": "557623c6-e499-48a6-a066-744f64f8b6f3",
"name": "DB 스키마 및 테이블 목록 가져오기",
"type": "n8n-nodes-base.postgresTool",
"position": [
580,
140
],
"parameters": {
"query": "SELECT \n table_schema,\n table_name\nFROM information_schema.tables\nWHERE table_type = 'BASE TABLE'\n AND table_schema NOT IN ('pg_catalog', 'information_schema')\nORDER BY table_schema, table_name;",
"options": {},
"operation": "executeQuery",
"descriptionType": "manual",
"toolDescription": "Get list of all tables with their schema in the database"
},
"credentials": {
"postgres": {
"id": "nGI61D0TEEZz18rr",
"name": "Your Postgresql Database Credentials"
}
},
"typeVersion": 2.5
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "10c7c74e-b383-4ac7-8cb2-c9a15a2818fe",
"connections": {
"0df33341-c859-4a54-b6d9-a99670e8d76d": {
"ai_memory": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "ai_memory",
"index": 0
}
]
]
},
"c18ced71-6330-4ba0-9c52-1bb5852b3039": {
"ai_tool": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "ai_tool",
"index": 0
}
]
]
},
"8accbeeb-7eaf-4e9e-aabc-de8ab3a0459b": {
"ai_languageModel": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"11f2013f-a080-4c9e-8773-c90492e2c628": {
"ai_tool": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "ai_tool",
"index": 0
}
]
]
},
"6501a54f-a68c-452d-b353-d7e871ca3780": {
"main": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "main",
"index": 0
}
]
]
},
"557623c6-e499-48a6-a066-744f64f8b6f3": {
"ai_tool": [
[
{
"node": "cd32221b-2a36-408d-b57e-8115fcd810c9",
"type": "ai_tool",
"index": 0
}
]
]
}
}
}자주 묻는 질문
이 워크플로우를 어떻게 사용하나요?
위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.
이 워크플로우는 어떤 시나리오에 적합한가요?
중급 - 엔지니어링, 제품, 인공지능, IT 운영
유료인가요?
이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.
관련 워크플로우 추천
데이터 분석사 Agent v3
用于电子表格의AI데이터분석어시스턴트,基于NocoDB平台
Set
Noco Db Tool
Http Request
+
Set
Noco Db Tool
Http Request
10 노드Derek Cheung
엔지니어링
Supabase 스토리지 내 파일과 대화하는 AI 에이전트
与Supabase存储中文件对话의AI스마트体
If
Merge
Switch
+
If
Merge
Switch
33 노드Mark Shcherbakov
엔지니어링
MySQL 데이터베이스 통합 AI 챗봇 워크플로우
MySQL 데이터베이스를 통합한 AI 기반 챗봇 워크플로우
My Sql Tool
Agent
Lm Chat Groq
+
My Sql Tool
Agent
Lm Chat Groq
11 노드Gegenfeld
엔지니어링
AI 스마트 어시스턴트: Supabase 스토리지 및 Google Drive 파일과 대화
AI스마트어시스턴트:与Supabase存储및Google Drive文件对话
If
Set
Wait
+
If
Set
Wait
62 노드Mark Shcherbakov
엔지니어링
Supabase-PostgreSQL 데이터베이스와 대화하는 AI 에이전트
用于与Supabase/PostgreSQL데이터库对话의AI스마트体
Postgres Tool
Agent
Tool Code
+
Postgres Tool
Agent
Tool Code
11 노드Mark Shcherbakov
엔지니어링
ozki: OpenAI CSV 분석
OpenAI 기반 데이터 에이전트를 사용한 Google Sheets 데이터 분석
Agent
Google Sheets Tool
Chat Trigger
+
Agent
Google Sheets Tool
Chat Trigger
6 노드ozkary
엔지니어링
워크플로우 정보
난이도
중급
노드 수11
카테고리4
노드 유형6
저자
KumoHQ
@kumohqAI Automation agency with over 3 years experience helping businesses to streamline their manual processes using AI agents. Use our link to book a free consultation for custom AI solutions and workflows.
외부 링크
n8n.io에서 보기 →
이 워크플로우 공유