@mastra/clickhouse 1.16.1-alpha.0 → 1.16.1-alpha.1
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.
- package/README.md +7 -119
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,13 +8,6 @@ Clickhouse implementation for Mastra, providing efficient storage capabilities w
|
|
|
8
8
|
npm install @mastra/clickhouse
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
## Prerequisites
|
|
12
|
-
|
|
13
|
-
- Clickhouse server (version 23.3 or higher required for delete operations; earlier versions may work for read/write operations)
|
|
14
|
-
- Lightweight `DELETE FROM` requires ClickHouse 22.8+ with `allow_experimental_lightweight_delete = 1` (for 22.8–23.2), or 23.3+ where it is generally available.
|
|
15
|
-
- The `deleteTask`, `deleteTasks`, and `deleteMessages` methods use `DELETE FROM` — ensure your server supports lightweight delete before using those operations.
|
|
16
|
-
- Node.js 22.13.0 or later
|
|
17
|
-
|
|
18
11
|
## Usage
|
|
19
12
|
|
|
20
13
|
```typescript
|
|
@@ -59,120 +52,15 @@ const { messages } = await store.listMessages({ threadId: 'thread-123' });
|
|
|
59
52
|
await store.close();
|
|
60
53
|
```
|
|
61
54
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
The Clickhouse store can be initialized with the following configuration:
|
|
65
|
-
|
|
66
|
-
```typescript
|
|
67
|
-
type ClickhouseConfig = {
|
|
68
|
-
url: string; // Clickhouse HTTP interface URL
|
|
69
|
-
username: string; // Database username
|
|
70
|
-
password: string; // Database password
|
|
71
|
-
replication?: {
|
|
72
|
-
cluster?: string; // Adds ON CLUSTER to Mastra-owned DDL when set
|
|
73
|
-
zookeeperPath?: string; // Defaults to '/clickhouse/tables/{shard}/{database}/{table}'
|
|
74
|
-
replicaName?: string; // Defaults to '{replica}'
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Replicated ClickHouse clusters
|
|
80
|
-
|
|
81
|
-
Set `replication` when Mastra writes to a multi-replica ClickHouse cluster through a load balancer. Mastra will create its tables with replicated MergeTree engines and add `ON CLUSTER` to Mastra-owned DDL when `cluster` is provided.
|
|
82
|
-
|
|
83
|
-
```typescript
|
|
84
|
-
const store = new ClickhouseStore({
|
|
85
|
-
url: 'http://clickhouse-lb:8123',
|
|
86
|
-
username: 'default',
|
|
87
|
-
password: 'password',
|
|
88
|
-
replication: {
|
|
89
|
-
cluster: 'company_cluster',
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
The default `zookeeperPath` is `/clickhouse/tables/{shard}/{database}/{table}`. If your cluster's existing tables use a different layout (for example `/clickhouse/tables/{shard}/{table}` without the `{database}` segment), set `zookeeperPath` explicitly to match. Mastra does not infer your cluster's convention from Keeper.
|
|
95
|
-
|
|
96
|
-
Manual maintenance such as `optimizeTable()` and `materializeTtl()` runs on every replica when `cluster` is set. These operations can be expensive on a large cluster. Prefer running them outside peak hours.
|
|
97
|
-
|
|
98
|
-
If Mastra finds an existing local `MergeTree` or `ReplacingMergeTree` table while replication is enabled, initialization fails instead of silently mixing local and replicated tables. Migrate existing local tables manually before enabling this option.
|
|
99
|
-
|
|
100
|
-
## Features
|
|
101
|
-
|
|
102
|
-
### Storage Features
|
|
103
|
-
|
|
104
|
-
- Thread and message storage with JSON support
|
|
105
|
-
- Efficient batch operations
|
|
106
|
-
- Rich metadata support
|
|
107
|
-
- Timestamp tracking
|
|
108
|
-
- Workflow snapshot persistence
|
|
109
|
-
- Optimized for high-volume data ingestion
|
|
110
|
-
- Uses Clickhouse's MergeTree and ReplacingMergeTree engines for optimal performance
|
|
111
|
-
|
|
112
|
-
### Table Engines
|
|
113
|
-
|
|
114
|
-
The store uses different table engines for different types of data:
|
|
115
|
-
|
|
116
|
-
- `MergeTree()`: Used for messages, traces, and evals
|
|
117
|
-
- `ReplacingMergeTree()`: Used for threads and workflow snapshots
|
|
118
|
-
- `ReplicatedMergeTree(...)` / `ReplicatedReplacingMergeTree(...)`: Used instead when `replication` is enabled
|
|
119
|
-
|
|
120
|
-
## Storage Methods
|
|
121
|
-
|
|
122
|
-
### Thread Operations
|
|
123
|
-
|
|
124
|
-
- `saveThread({ thread })`: Create or update a thread
|
|
125
|
-
- `getThreadById({ threadId })`: Get a thread by ID
|
|
126
|
-
- `listThreadsByResourceId({ resourceId, offset, limit, orderBy? })`: List paginated threads for a resource
|
|
127
|
-
- `updateThread({ id, title, metadata })`: Update thread title and metadata
|
|
128
|
-
- `deleteThread({ threadId })`: Delete a thread and its messages
|
|
129
|
-
|
|
130
|
-
### Message Operations
|
|
131
|
-
|
|
132
|
-
- `saveMessages({ messages })`: Save multiple messages
|
|
133
|
-
- `listMessages({ threadId, perPage?, page? })`: Get messages for a thread with pagination
|
|
134
|
-
- `updateMessages({ messages })`: Update existing messages
|
|
135
|
-
|
|
136
|
-
### Resource Operations
|
|
137
|
-
|
|
138
|
-
- `getResourceById({ resourceId })`: Get a resource by ID
|
|
139
|
-
- `saveResource({ resource })`: Create or save a resource
|
|
140
|
-
- `updateResource({ resourceId, workingMemory })`: Update resource working memory
|
|
141
|
-
|
|
142
|
-
### Workflow Operations
|
|
143
|
-
|
|
144
|
-
- `persistWorkflowSnapshot({ workflowName, runId, snapshot })`: Save workflow state
|
|
145
|
-
- `loadWorkflowSnapshot({ workflowName, runId })`: Load workflow state
|
|
146
|
-
- `listWorkflowRuns({ workflowName, pagination })`: List workflow runs with pagination
|
|
147
|
-
- `getWorkflowRunById({ workflowName, runId })`: Get a specific workflow run
|
|
148
|
-
|
|
149
|
-
### Evaluation/Scoring Operations
|
|
150
|
-
|
|
151
|
-
- `getScoreById({ id })`: Get a score by ID
|
|
152
|
-
- `saveScore(score)`: Save an evaluation score
|
|
153
|
-
- `listScoresByScorerId({ scorerId, pagination })`: List scores by scorer with pagination
|
|
154
|
-
- `listScoresByRunId({ runId, pagination })`: List scores by run with pagination
|
|
155
|
-
- `listScoresByEntityId({ entityId, entityType, pagination })`: List scores by entity with pagination
|
|
156
|
-
- `listScoresBySpan({ traceId, spanId, pagination })`: List scores by span with pagination
|
|
157
|
-
|
|
158
|
-
### Operations Not Currently Supported
|
|
159
|
-
|
|
160
|
-
- AI Observability (traces/spans): Not currently supported
|
|
55
|
+
## Documentation
|
|
161
56
|
|
|
162
|
-
|
|
57
|
+
- [ClickHouse integration guide](https://mastra.ai/integrations/databases/clickhouse)
|
|
58
|
+
- [Storage reference](https://mastra.ai/reference/storage/overview)
|
|
163
59
|
|
|
164
|
-
|
|
60
|
+
## Changelog
|
|
165
61
|
|
|
166
|
-
-
|
|
167
|
-
- `timestamp`: DateTime64(3)
|
|
168
|
-
- `uuid`: String
|
|
169
|
-
- `jsonb`: String (JSON serialized)
|
|
170
|
-
- `integer`: Int64
|
|
171
|
-
- `bigint`: Int64
|
|
172
|
-
- `float`: Float64
|
|
173
|
-
- `boolean`: Bool
|
|
62
|
+
See the [package changelog](https://github.com/mastra-ai/mastra/blob/main/stores/clickhouse/CHANGELOG.md) for version history and release notes.
|
|
174
63
|
|
|
175
|
-
##
|
|
64
|
+
## Support
|
|
176
65
|
|
|
177
|
-
|
|
178
|
-
- [Clickhouse Node.js Client](https://github.com/clickhouse/clickhouse-js)
|
|
66
|
+
We have an [open community Discord](https://discord.gg/mastra-ai). Come and say hello and let us know if you have any questions or need any help getting things running.
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-clickhouse
|
|
|
3
3
|
description: Documentation for @mastra/clickhouse. Use when working with @mastra/clickhouse APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/clickhouse"
|
|
6
|
-
version: "1.16.1-alpha.
|
|
6
|
+
version: "1.16.1-alpha.1"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/clickhouse",
|
|
3
|
-
"version": "1.16.1-alpha.
|
|
3
|
+
"version": "1.16.1-alpha.1",
|
|
4
4
|
"description": "Clickhouse provider for Mastra - includes db storage capabilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@internal/lint": "0.0.129",
|
|
36
36
|
"@internal/storage-test-utils": "0.0.125",
|
|
37
37
|
"@internal/types-builder": "0.0.104",
|
|
38
|
-
"@mastra/core": "1.64.0-alpha.
|
|
38
|
+
"@mastra/core": "1.64.0-alpha.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@mastra/core": ">=1.60.0-0 <2.0.0-0",
|