Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to Viewstor are documented here. Format based on [Keep a Cha

## [Unreleased]

### Added
- **Pinecone vector database driver** — browse indexes and namespaces, query vectors by similarity, upsert/delete vectors, view index statistics. Connection uses API key (no host/port). Custom command syntax: `QUERY <index> vector=[...] topK=N`, `UPSERT`, `DELETE`, `STATS`, `LIST`. Read-only mode disables upsert/delete ([#15](https://github.com/Siyet/viewstor/issues/15))

### Fixed
- **Pagination broken after running a custom query in table mode** — editing the SQL in the table view ran the query once and showed `Page 1/1`; clicking Next silently reverted to the original table. `_runCustomTableQuery` now accepts a `page` parameter, strips the trailing `LIMIT [OFFSET]`, re-applies server-side `LIMIT pageSize OFFSET page*pageSize`, and gets the exact row count via `SELECT COUNT(*) FROM (<user query>) _sub`. Webview forwards the active custom query on every `changePage` / `changePageSize` so the host routes back to the same query instead of falling back to the default table fetch. User's explicit `LIMIT` is respected as a ceiling — e.g. `LIMIT 250` with `pageSize=100` yields exactly `100 + 100 + 50` rows across three pages, not `100 + 100 + 100`. When the count query fails (exotic SQL) pagination falls back to a "page full ⇒ probably more" heuristic. Manual ORDER BY in the SQL bar now syncs back to the header sort icons on Run. Destructive statements (VACUUM / INSERT / UPDATE / DELETE / DROP / …) are blocked at the host — only SELECT / WITH / EXPLAIN / SHOW / VALUES / TABLE are executed. Clearing the SQL bar and pressing Refresh re-populates the field with the default table SELECT so the baseline is always recoverable

Expand Down
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Guidance for Claude Code when working with this repository.

## What is Viewstor

VS Code extension for database management. Supports PostgreSQL, Redis, ClickHouse, SQLite. Free, open-source (AGPL-3.0) alternative to DBeaver/DataGrip. Follows [ZeroVer](https://0ver.org) — version 0.x until API is stable.
VS Code extension for database management. Supports PostgreSQL, Redis, ClickHouse, SQLite, Pinecone. Free, open-source (AGPL-3.0) alternative to DBeaver/DataGrip. Follows [ZeroVer](https://0ver.org) — version 0.x until API is stable.

## Commands

Expand Down Expand Up @@ -33,7 +33,7 @@ Required methods: `connect`, `disconnect`, `ping`, `execute`, `getSchema`, `getT

Optional: `getTableRowCount`, `getEstimatedRowCount` (pg_class.reltuples / system.tables), `getDDL`, `cancelQuery` (PG: pg_cancel_backend, CH: AbortController), `getCompletions` (structured: table/view/column/schema with parent), `getIndexedColumns` (pg_index query), `getTableObjects` (indexes, constraints, triggers, sequences — used by data diff), `getTableStatistics` (row count, sizes, vacuum info, scan counters — used by stats diff tab; PG uses `pg_table_size`/`pg_indexes_size` + `pg_stat_user_tables`, CH uses `system.tables` + `system.parts`, SQLite uses `COUNT(*)` + optional `dbstat` vtable).

Drivers: `postgres.ts` (pg), `redis.ts` (ioredis), `clickhouse.ts` (@clickhouse/client), `sqlite.ts` (better-sqlite3).
Drivers: `postgres.ts` (pg), `redis.ts` (ioredis), `clickhouse.ts` (@clickhouse/client), `sqlite.ts` (better-sqlite3), `pinecone.ts` (@pinecone-database/pinecone).

### Connections
`src/connections/connectionManager.ts` — persists in VS Code `globalState` (keys: `viewstor.connections`, `viewstor.connectionFolders`).
Expand Down Expand Up @@ -231,3 +231,4 @@ All commands support `databaseName` parameter for multi-DB connections.
- ClickHouse execute uses `JSON` format (not `JSONEachRow`) to get column types from response metadata
- SQLite: file-based connection (`config.database` = file path or `:memory:`), no host/port/auth. Uses `sqlite_master` + `PRAGMA table_info()` for schema. `getEstimatedRowCount()` falls back to exact `COUNT(*)`. WAL journal mode enabled on connect (skipped for readonly). Foreign keys always enabled. Connection form shows file picker instead of host/port fields. `inferTypeFromValue()` detects column types for computed expressions (COUNT→INTEGER, SUM→REAL).
- SQLite native module: `better-sqlite3` requires different prebuilds for Node.js (tests) and Electron (Extension Host). `scripts/sqlite-rebuild.js` manages dual builds with `prebuild-install` (NOT `electron-rebuild` which is broken). Cache in `node_modules/.cache/sqlite-builds/` with `.meta` files. `npm run dev/build/watch` auto-restores Electron binary; `npm test` switches to Node.js binary.
- Pinecone: cloud vector database, API key auth (`config.password` = API key), no host/port. Uses `@pinecone-database/pinecone` SDK via lazy `require()`. Schema: indexes as tables, namespaces as children. Custom command parser (`parsePineconeCommand`): `QUERY <index> vector=[...] topK=N`, `UPSERT <index> id=... vector=[...]`, `DELETE <index> ids=[...]`, `STATS <index>`, `LIST <index>`. Optional methods: `getEstimatedRowCount` (describeIndexStats), `getTableStatistics`. Connection form shows API key field instead of host/port/auth.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ All shortcuts use physical key codes — work on any keyboard layout.
| Redis | TCP | [ioredis](https://www.npmjs.com/package/ioredis) |
| ClickHouse | HTTP | [@clickhouse/client](https://www.npmjs.com/package/@clickhouse/client) |
| SQLite | File | [better-sqlite3](https://www.npmjs.com/package/better-sqlite3) |
| Pinecone | HTTPS | [@pinecone-database/pinecone](https://www.npmjs.com/package/@pinecone-database/pinecone) |

## Development

Expand Down
2 changes: 1 addition & 1 deletion l10n/nls/package.nls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extension.description": "Database management tool for VS Code — browse schemas, run queries, and inspect data across PostgreSQL, Redis, ClickHouse, and SQLite.",
"extension.description": "Database management tool for VS Code — browse schemas, run queries, and inspect data across PostgreSQL, Redis, ClickHouse, SQLite, and Pinecone.",
"view.connections.name": "Connections",
"view.queryHistory.name": "Query History",
"command.addConnection": "Add Connection",
Expand Down
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"redis",
"clickhouse",
"sqlite",
"pinecone",
"vector",
"sql",
"query",
"schema"
Expand Down Expand Up @@ -82,6 +84,13 @@
"fontPath": "resources/viewstor-icons.woff2",
"fontCharacter": "\\E004"
}
},
"viewstor-pinecone": {
"description": "Pinecone",
"default": {
"fontPath": "resources/viewstor-icons.woff2",
"fontCharacter": "\\E005"
}
}
},
"mcpServerDefinitionProviders": [
Expand Down Expand Up @@ -628,6 +637,7 @@
"webpack-cli": "^5.1.0"
},
"dependencies": {
"@pinecone-database/pinecone": "^7.2.0",
"@vscode-elements/elements": "^2.5.1",
"@vscode/codicons": "^0.0.45",
"better-sqlite3": "^12.8.0",
Expand Down
3 changes: 3 additions & 0 deletions src/drivers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { PostgresDriver } from './postgres';
import { RedisDriver } from './redis';
import { ClickHouseDriver } from './clickhouse';
import { SqliteDriver } from './sqlite';
import { PineconeDriver } from './pinecone';

export function createDriver(type: DatabaseType): DatabaseDriver {
switch (type) {
Expand All @@ -15,6 +16,8 @@ export function createDriver(type: DatabaseType): DatabaseDriver {
return new ClickHouseDriver();
case 'sqlite':
return new SqliteDriver();
case 'pinecone':
return new PineconeDriver();
default:
throw new Error(`Unsupported database type: ${type}`);
}
Expand Down
Loading
Loading