node-red-contrib-questdb 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +213 -3
  2. package/package.json +12 -3
  3. package/nul +0 -46
package/README.md CHANGED
@@ -1,19 +1,229 @@
1
1
  # node-red-contrib-questdb
2
2
 
3
- Node-RED nodes for QuestDB time-series database.
3
+ Node-RED nodes for writing data to [QuestDB](https://questdb.io/) time-series database using the Influx Line Protocol (ILP).
4
+
5
+ ## Features
6
+
7
+ - **High-performance writes** using QuestDB's native ILP protocol
8
+ - **Connection pooling** with automatic reconnection
9
+ - **Multiple protocols**: HTTP, HTTPS, TCP, TCPS
10
+ - **Authentication**: Basic auth and Bearer token support
11
+ - **TLS/SSL**: Full TLS support with certificate verification options
12
+ - **Flexible data mapping**: Map message fields to QuestDB columns
13
+ - **Type support**: Symbols, floats, integers, longs, booleans, strings, timestamps, arrays, and decimals
14
+ - **Auto-flush**: Configurable automatic flushing by row count or time interval
15
+ - **Examples included**: Ready-to-use flow examples
4
16
 
5
17
  ## Installation
6
18
 
19
+ ### Via Node-RED Palette Manager
20
+
21
+ 1. Open Node-RED
22
+ 2. Go to **Menu** > **Manage palette** > **Install**
23
+ 3. Search for `node-red-contrib-questdb`
24
+ 4. Click **Install**
25
+
26
+ ### Via npm
27
+
7
28
  ```bash
29
+ cd ~/.node-red
8
30
  npm install node-red-contrib-questdb
9
31
  ```
10
32
 
33
+ Then restart Node-RED.
34
+
11
35
  ## Nodes
12
36
 
13
- ### questdb
37
+ ### QuestDB Write
38
+
39
+ Writes data to QuestDB using the ILP protocol.
40
+
41
+ #### Configuration
42
+
43
+ **Connection Settings:**
44
+ - **Protocol**: HTTP (default), HTTPS, TCP, or TCPS
45
+ - **Host**: QuestDB server hostname or IP
46
+ - **Port**: 9000 (HTTP) or 9009 (TCP)
47
+
48
+ **Security Settings:**
49
+ - **Enable Auth**: Toggle authentication
50
+ - **Auth Type**: Username/Password or Bearer Token
51
+ - **TLS Verify**: Verify server certificate (for HTTPS/TCPS)
52
+
53
+ **Advanced Settings:**
54
+ - **Auto Flush**: Enable automatic flushing
55
+ - **Flush Rows**: Number of rows before auto-flush (default: 75000)
56
+ - **Flush Interval**: Time interval for auto-flush in ms (default: 1000)
57
+ - **Request Timeout**: HTTP request timeout in ms
58
+ - **Buffer Size**: Initial and maximum buffer sizes
59
+
60
+ #### Input Message Format
61
+
62
+ ```javascript
63
+ msg.topic = "table_name";
64
+ msg.payload = {
65
+ symbols: {
66
+ tag_name: "sensor1", // Indexed string columns
67
+ location: "warehouse"
68
+ },
69
+ columns: {
70
+ temperature: 23.5, // Auto-detected as float
71
+ humidity: 65, // Auto-detected as float
72
+ status: "active", // String column
73
+ alert: true // Boolean column
74
+ },
75
+ timestamp: Date.now() // Optional: milliseconds or Date object
76
+ };
77
+ ```
78
+
79
+ #### Explicit Type Specification
80
+
81
+ For precise control over column types:
82
+
83
+ ```javascript
84
+ msg.payload = {
85
+ symbols: { device: "sensor1" },
86
+ columns: {
87
+ value: { value: 123456789, type: "long" },
88
+ price: { value: "123.456789", type: "decimal" },
89
+ readings: { value: [1.1, 2.2, 3.3], type: "array", elementType: "double" }
90
+ },
91
+ timestamp: Date.now()
92
+ };
93
+ ```
94
+
95
+ **Supported Types:**
96
+ - `int` / `integer` - 32-bit signed integer
97
+ - `long` - 64-bit signed integer
98
+ - `float` - 32-bit floating point
99
+ - `double` - 64-bit floating point
100
+ - `decimal` - Arbitrary precision decimal
101
+ - `string` - Text value
102
+ - `boolean` - true/false
103
+ - `timestamp` - Date/time value
104
+ - `array` - Array with auto-detected element type
105
+ - `array_double` - Array of doubles
106
+ - `array_long` - Array of longs
107
+ - `array_string` - Array of strings
108
+
109
+ ### QuestDB Mapper
110
+
111
+ Maps incoming message fields to QuestDB ILP structure. Useful for transforming data from various sources.
112
+
113
+ #### Configuration
114
+
115
+ - **Table Name**: Target table (or use `msg.topic`)
116
+ - **Timestamp Field**: Path to timestamp field in message
117
+ - **Symbol Mappings**: Map source fields to QuestDB symbols
118
+ - **Column Mappings**: Map source fields to columns with type conversion
119
+
120
+ #### Example
121
+
122
+ Input message:
123
+ ```javascript
124
+ {
125
+ topic: "sensors",
126
+ payload: {
127
+ device: "sensor1",
128
+ temp: 23.5,
129
+ readings: [1.1, 2.2, 3.3],
130
+ ts: 1699999999000
131
+ }
132
+ }
133
+ ```
134
+
135
+ With mappings:
136
+ - Symbol: `payload.device` → `device_id`
137
+ - Column: `payload.temp` → `temperature` (double)
138
+ - Column: `payload.readings` → `values` (array_double)
139
+ - Timestamp: `payload.ts`
140
+
141
+ Output:
142
+ ```javascript
143
+ {
144
+ topic: "sensors",
145
+ payload: {
146
+ symbols: { device_id: "sensor1" },
147
+ columns: {
148
+ temperature: { value: 23.5, type: "double" },
149
+ values: { value: [1.1, 2.2, 3.3], type: "array", elementType: "double" }
150
+ },
151
+ timestamp: 1699999999000
152
+ }
153
+ }
154
+ ```
155
+
156
+ ## Examples
157
+
158
+ The package includes ready-to-use examples. After installation:
159
+
160
+ 1. Open Node-RED
161
+ 2. Go to **Menu** > **Import**
162
+ 3. Select **Examples** > **node-red-contrib-questdb**
163
+
164
+ ### Available Examples
165
+
166
+ 1. **Basic Write** - Simple sensor data write
167
+ 2. **Batch Write** - Writing arrays of measurements
168
+ 3. **Using Mapper** - Transform MQTT data for QuestDB
169
+ 4. **Direct Value Write** - Simple numeric writes
170
+ 5. **Multiple Tables** - Writing to different tables
171
+ 6. **With Timestamp** - Custom timestamp handling
172
+ 7. **Continuous Data** - Generating continuous metrics
173
+
174
+ ## QuestDB Setup
175
+
176
+ ### Using Docker
177
+
178
+ ```bash
179
+ docker run -p 9000:9000 -p 9009:9009 questdb/questdb
180
+ ```
181
+
182
+ ### Connection String Format
183
+
184
+ The node uses QuestDB's connection string format internally:
185
+
186
+ ```
187
+ http::addr=localhost:9000;auto_flush_rows=75000;auto_flush_interval=1000;
188
+ ```
189
+
190
+ ## Compatibility
191
+
192
+ - **Node-RED**: >= 2.0.0
193
+ - **Node.js**: >= 14.0.0
194
+ - **QuestDB**: >= 6.0 (recommended: latest)
195
+
196
+ ## Troubleshooting
197
+
198
+ ### Connection Issues
199
+
200
+ 1. Verify QuestDB is running: `curl http://localhost:9000`
201
+ 2. Check firewall settings for ports 9000/9009
202
+ 3. For HTTPS/TCPS, ensure certificates are properly configured
14
203
 
15
- A node for interacting with QuestDB time-series database.
204
+ ### Data Not Appearing
205
+
206
+ 1. Check the node status indicator (green = connected)
207
+ 2. Verify table creation in QuestDB console
208
+ 3. Enable debug output to see write confirmations
209
+
210
+ ### Performance Tips
211
+
212
+ 1. Use symbols for frequently queried columns (they're indexed)
213
+ 2. Batch writes when possible using arrays
214
+ 3. Adjust auto-flush settings based on your write patterns
16
215
 
17
216
  ## License
18
217
 
19
218
  MIT
219
+
220
+ ## Author
221
+
222
+ **Holger Amort**
223
+
224
+ ## Links
225
+
226
+ - [QuestDB Documentation](https://questdb.io/docs/)
227
+ - [QuestDB Node.js Client](https://github.com/questdb/nodejs-questdb-client)
228
+ - [GitHub Repository](https://github.com/ErnstHolger/node-red)
229
+ - [Report Issues](https://github.com/ErnstHolger/node-red/issues)
package/package.json CHANGED
@@ -1,17 +1,26 @@
1
1
  {
2
2
  "name": "node-red-contrib-questdb",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Node-RED nodes for QuestDB time-series database",
5
+ "author": {
6
+ "name": "Holger Amort"
7
+ },
5
8
  "keywords": [
6
9
  "node-red",
7
10
  "questdb",
8
11
  "time-series",
9
- "database"
12
+ "database",
13
+ "ilp",
14
+ "influx-line-protocol"
10
15
  ],
11
16
  "license": "MIT",
17
+ "homepage": "https://github.com/ErnstHolger/node-red#readme",
18
+ "bugs": {
19
+ "url": "https://github.com/ErnstHolger/node-red/issues"
20
+ },
12
21
  "repository": {
13
22
  "type": "git",
14
- "url": ""
23
+ "url": "git+https://github.com/ErnstHolger/node-red.git"
15
24
  },
16
25
  "node-red": {
17
26
  "version": ">=2.0.0",
package/nul DELETED
@@ -1,46 +0,0 @@
1
- [
2
- "0.0.1",
3
- "0.0.2",
4
- "0.0.4",
5
- "0.0.5",
6
- "0.0.6",
7
- "0.0.7",
8
- "0.0.8",
9
- "0.0.9",
10
- "0.0.10",
11
- "0.0.11",
12
- "0.0.12",
13
- "0.0.14",
14
- "0.0.15",
15
- "0.0.16",
16
- "0.0.17",
17
- "0.0.18",
18
- "0.0.20",
19
- "0.0.21",
20
- "0.0.22",
21
- "0.0.23",
22
- "0.0.24",
23
- "0.0.25",
24
- "0.0.26",
25
- "0.0.27",
26
- "0.0.28",
27
- "0.0.29",
28
- "0.0.30",
29
- "0.0.31",
30
- "0.0.32",
31
- "0.0.33",
32
- "0.0.34",
33
- "1.0.0",
34
- "1.0.1",
35
- "1.0.2",
36
- "1.0.3",
37
- "1.0.4",
38
- "1.0.5",
39
- "2.0.0",
40
- "2.1.0",
41
- "3.0.0",
42
- "4.0.1",
43
- "4.0.2",
44
- "4.1.0",
45
- "4.2.0"
46
- ]