Skip to content

Add pc index import command group#91

Merged
austin-denoble merged 3 commits into
mainfrom
adenoble/implement-import
Jun 8, 2026
Merged

Add pc index import command group#91
austin-denoble merged 3 commits into
mainfrom
adenoble/implement-import

Conversation

@austin-denoble

@austin-denoble austin-denoble commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Problem

The CLI has no support for bulk imports despite the Go SDK fully exposing them. Imports load vector data from a storage provider (S3, GCS, Azure) directly into a serverless index — a common data-loading path that currently requires dropping down to the API or SDK.

Solution

Adds pc index import as a new subcommand group under pc index, alongside the existing backup, restore, and collection groups. Implements four subcommands backed by IndexConnection.{StartImport, DescribeImport, ListImports, CancelImport}.

Fixes a tabwriter column alignment bug where ANSI color codes in status cells inflated column widths, causing headers to misalign with data rows in list views. Introduces printColorizedTable, which buffers plain text through tabwriter for correct width calculation, then splices colorized values in at the byte offsets read from the formatted header line. Applies to import, backup, and restore job list tables.

Commands

Start an import

$ pc index import start --index-name my-index --uri s3://my-bucket/data/
[SUCCESS] Import import-abc123 started.

ATTRIBUTE   VALUE
Import ID   import-abc123

Optional flags: --error-mode continue|abort (default: continue), --integration-id for private buckets.

List imports for an index

$ pc index import list --index-name my-index
IMPORT ID       STATUS      URI                       PERCENT   RECORDS   CREATED               FINISHED
import-abc123   InProgress  s3://my-bucket/data/      42.0%     18302     2026-06-05T18:00:00Z  <none>
import-def456   Completed   s3://my-bucket/archive/   100.0%    84011     2026-06-04T09:00:00Z  2026-06-04T09:12:00Z

Describe a specific import

$ pc index import describe --index-name my-index --id import-abc123
ATTRIBUTE          VALUE
Import ID          import-abc123
Status             InProgress
URI                s3://my-bucket/data/
Percent Complete   42.0%
Records Imported   18302
Created At         2026-06-05T18:00:00Z
Finished At        <none>
Error              <none>

Cancel an in-progress import

$ pc index import cancel --index-name my-index --id import-abc123
[SUCCESS] Import import-abc123 cancelled.

All commands support --json for machine-readable output.

Notes

  • Imports operate on an IndexConnection (requires the index host), unlike backup/restore which are client-level operations. Each command resolves the host via sdk.NewIndexConnection.
  • ImportService interface is satisfied directly by *pinecone.IndexConnection — no adapter needed.

Note

Medium Risk
New index data-loading operations can trigger large imports and cancel in-flight jobs; changes are mostly CLI/presentation with unit tests, but mistakes could affect production index data loads.

Overview
Adds pc index import under index management so users can start, describe, list, and cancel serverless bulk imports from storage URIs (with optional --integration-id, --error-mode, pagination, and --json). Commands use an index connection via sdk.NewIndexConnection and a testable ImportService backed by the Go SDK.

Introduces printColorizedTable so list tables can colorize status without breaking tab alignment; backup and restore job list output is switched to this helper, and new import list/detail presenters use it. Backup detail view drops the Metric row from the attribute table.

Reviewed by Cursor Bugbot for commit 7bf60fa. Bugbot is set up for automated code reviews on this repo. Configure here.

Implements start, describe, list, and cancel subcommands backed by IndexConnection.{StartImport,DescribeImport,ListImports,CancelImport}
ANSI escape bytes were inflating column widths in multi-column list tables, causing headers to misalign with data rows. Introduces printColorizedTable, which writes plain text to a buffered tabwriter for correct width calculation, then splices colorized values in at the column byte offsets read from the formatted header line. Updates PrintImportList, PrintBackupList, and PrintRestoreJobList to use it, and adds status colorization to the two backup list views which were missing it.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7bf60fa. Configure here.

Comment thread internal/pkg/utils/presenters/backup.go
@austin-denoble austin-denoble merged commit 0ef1e5e into main Jun 8, 2026
8 checks passed
@austin-denoble austin-denoble deleted the adenoble/implement-import branch June 8, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant