Skip to content

feat: add Pinecone vector database driver - #115

Open
Siyet wants to merge 3 commits into
trunkfrom
15-pinecone-driver
Open

feat: add Pinecone vector database driver#115
Siyet wants to merge 3 commits into
trunkfrom
15-pinecone-driver

Conversation

@Siyet

@Siyet Siyet commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Full PineconeDriver implementation using @pinecone-database/pinecone SDK — browse indexes and namespaces, query vectors by similarity, upsert/delete vectors, view index statistics
  • Integrated across all touchpoints: connection form (API key field, no host/port), driver factory, MCP standalone server, import service (DBeaver + DataGrip), tree view (namespace icon), webpack externals
  • Custom command syntax via parsePineconeCommand: QUERY <index> vector=[...] topK=N, UPSERT <index> id=... vector=[...], DELETE <index> ids=[...], STATS <index>, LIST <index>

Closes #15

Assumptions

  • API key stored as config.password. Pinecone uses API key auth with no username. The connection form shows a dedicated "API Key" field that maps to the password field internally, consistent with how Redis stores its password.
  • No host/port fields. Pinecone is a managed cloud service; the SDK resolves endpoints from the API key. The connection form hides host/port/SSL/proxy when Pinecone is selected.
  • Custom command parser, not SQL. Like Redis, Pinecone doesn't use SQL. The execute() method parses a custom syntax: COMMAND index-name key=value .... JSON arrays/objects in params are supported for vectors, metadata, and filters.
  • Lazy require. The @pinecone-database/pinecone SDK is loaded via lazy require() to avoid blocking extension activation, following the same pattern as other drivers.
  • Icon uses next available font character. \E005 is used for the viewstor-pinecone icon in the existing viewstor-icons.woff2 font. If the glyph doesn't exist yet, the icon will fall back to the default; the font file needs a corresponding glyph added separately.
  • No Grafana export. Pinecone has no Grafana datasource plugin, so it's excluded from DB_TYPE_TO_GRAFANA_DS.
  • No safe mode. Pinecone doesn't support EXPLAIN, so safe mode checks are not applicable (the existing isSafeModeDB check already excludes unknown types).
  • Mock-based tests only. No free tier suitable for CI; unit tests cover the command parser (12 tests) and driver contract verification.

Manual test cases

  • Golden path: Add Connection → select "Pinecone" → enter API key → Test Connection → Save → expand tree (indexes with dimension/metric detail, namespaces with vector counts) → click an index → Result Panel shows id/values/metadata columns
  • Query vectors: Open query editor on Pinecone connection → QUERY my-index vector=[0.1,0.2,0.3] topK=5 → results show id, score, truncated values, metadata JSON
  • Upsert: UPSERT my-index id=test-1 vector=[0.1,0.2] metadata={"key":"val"} → success message
  • Delete: DELETE my-index ids=["test-1"] → success message with count
  • Stats: STATS my-index → table with total vectors, dimension, metric, namespaces, index fullness
  • List: LIST my-index namespace=ns1 prefix=doc_ limit=10 → list of vector IDs
  • Read-only mode: Mark connection read-only → upsert/delete should fail at the host level (readonly check)
  • Invalid command: SELECT * FROM my-index → error message with supported command syntax
  • MCP: add_connection with type: "pinecone", password: "<api-key>" → connection created successfully

Checklist

  • README — added Pinecone row to Supported Databases table
  • CHANGELOG — added entry under [Unreleased] > Added
  • CLAUDE.md — updated "What is Viewstor", Drivers list, Key Conventions with Pinecone-specific notes
  • l10n — extension description includes Pinecone
  • Wiki — new Pinecone driver section (note: cannot push wiki from PR)

Generated by Claude Code

claude added 3 commits April 26, 2026 05:25
Closes #15

Full PineconeDriver implementation using @pinecone-database/pinecone SDK.
Integrated across connection form, driver factory, MCP server, import
service, tree view, and driver contract tests.

- Schema: indexes as tables, namespaces as children with vector counts
- Custom command syntax: QUERY, UPSERT, DELETE, STATS, LIST
- Connection form: API key field, no host/port
- Optional methods: getEstimatedRowCount, getTableStatistics
- 12 unit tests for command parser, driver contract tests updated
…ands

The regex-based parser truncated nested JSON values like
filter={"$and":[{"a":1},{"b":2}]} at the first closing brace.
Replace with a bracket-counting parser that handles nested structures
and string escaping within JSON.

https://claude.ai/code/session_01RwjTCNaBKhphYNzopBwqK1
isReadOnlyQuery() only recognized SQL verbs, blocking all Pinecone
commands (QUERY, STATS, LIST) on read-only connections via MCP.
Add Pinecone read verbs to READ_VERB_RE and update the error message.

https://claude.ai/code/session_01RwjTCNaBKhphYNzopBwqK1

@Siyet Siyet left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes pushed

  • 8d85d6e — Replace regex-based param parser with bracket-counting parser that handles nested JSON (e.g. filter={"$and":[{"a":1},{"b":2}]}). Added 2 test cases.
  • d55e08e — Add Pinecone read commands (QUERY, STATS, LIST) to READ_VERB_RE so read-only connections can execute them via MCP. Updated error message. Added 3 test cases.

Issues to address

  • src/drivers/pinecone.ts:1 — Top-level import { DatabaseDriver } is consistent with other drivers, but the PineconeDriver import in src/drivers/index.ts:7 eagerly loads the entire pinecone.ts module at extension activation. For a cloud-only SDK unlikely to be installed on most machines, consider a lazy require() in the factory's case 'pinecone': branch (matching the lazy pattern already inside the driver itself).
  • package.json — The viewstor-pinecone icon references \\E005 in viewstor-icons.woff2, but the PR doesn't add a glyph to the font file. The icon will silently fall back to nothing until the font is updated.
  • src/drivers/pinecone.ts:233executeQuery uses parsed.params.topk || parsed.params.topK to handle case variants, but all other params are case-sensitive. Consider normalizing param keys to lowercase in the parser for consistency.

Generated by Claude Code

@Siyet Siyet added the reviewed label Apr 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add Pinecone driver

2 participants