Implementation:AI Northstar Tech Vector io Export CLI
| Knowledge Sources | |
|---|---|
| Domains | CLI, Export, Plugin_Architecture |
| Last Updated | 2026-10-15 00:00 GMT |
Overview
Concrete CLI entry point for exporting vector database data to the VDF format, provided by the vector-io library.
Description
The export_vdf_cli module is the command-line entry point for the export_vdf command. It dynamically discovers all ExportVDB subclasses via pkgutil.walk_packages, builds an argparse-based CLI with subparsers for each supported vector database, and orchestrates the export pipeline. Telemetry is initialized via Sentry and OpenTelemetry (opt-out via DISABLE_TELEMETRY_VECTORIO env var).
The load_subclasses function scans the vdf_io.export_vdf package, imports every module, and collects all classes that subclass ExportVDB. Each subclass is registered by its DB_NAME_SLUG class variable, mapping to its export_vdb classmethod (factory) and make_parser classmethod (CLI subparser setup).
The run_export function constructs the top-level parser, attaches per-DB subparsers, parses CLI args, instantiates the appropriate ExportVDB subclass, and optionally triggers push_to_hub if requested.
Usage
Import and invoke this module when you need to run a vector database export from the command line. It is the standard entry point for the export_vdf console script defined in setup.py.
Code Reference
Source Location
- Repository: vector-io
- File: src/vdf_io/export_vdf_cli.py
Signature
def load_subclasses(package_dir: str) -> Tuple[Dict[str, Callable], Dict[str, Callable]]:
"""
Dynamically import all modules in package_dir and collect ExportVDB subclasses.
Args:
package_dir: Dotted package path to scan (e.g. "vdf_io.export_vdf")
Returns:
Tuple of (slug_to_export_func, slug_to_parser_func) dicts mapping
DB_NAME_SLUG -> export_vdb classmethod and DB_NAME_SLUG -> make_parser classmethod.
"""
def run_export(span) -> None:
"""
Build CLI parser with per-DB subparsers, parse args, instantiate the
selected ExportVDB subclass, run export, and optionally push to HuggingFace Hub.
Args:
span: OpenTelemetry span for telemetry tracing.
"""
def make_common_options(parser: argparse.ArgumentParser) -> None:
"""
Add shared CLI arguments: --model_name, --max_file_size, --push_to_hub, --public.
"""
Import
from vdf_io.export_vdf_cli import load_subclasses, run_export, make_common_options
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| package_dir | str | Yes | Dotted package path to scan for ExportVDB subclasses |
| span | trace.Span | Yes | OpenTelemetry span for telemetry |
| --vector_database | str (CLI) | Yes | Subcommand selecting the source vector database |
| --model_name | str (CLI) | No | Name of embedding model used (default: "NOT_PROVIDED") |
| --max_file_size | int (CLI) | No | Max parquet file size in MB (default: 1024) |
| --push_to_hub | bool (CLI) | No | Whether to push to HuggingFace Hub after export |
| --public | bool (CLI) | No | Make HuggingFace dataset public (default: False) |
| DB-specific args | varies | Varies | Per-DB credentials and options via subparser |
Outputs
| Name | Type | Description |
|---|---|---|
| slug_to_export_func | Dict[str, Callable] | Maps DB_NAME_SLUG to export_vdb classmethod |
| slug_to_parser_func | Dict[str, Callable] | Maps DB_NAME_SLUG to make_parser classmethod |
| export_obj | ExportVDB | Instantiated export subclass with vdf_directory on disk |
| VDF directory | Files on disk | Parquet files + VDF_META.json in vdf_<timestamp>_<hash>/ |
Usage Examples
Command-Line Usage
# Export from Pinecone with model name
export_vdf pinecone --model_name text-embedding-3-small
# Export from Qdrant and push to HuggingFace Hub
export_vdf qdrant --push_to_hub --public
# Export from Milvus with max file size
export_vdf milvus --max_file_size 512 --model_name all-MiniLM-L6-v2
Programmatic Subclass Discovery
from vdf_io.export_vdf_cli import load_subclasses
# Discover all available export backends
slug_to_export, slug_to_parser = load_subclasses("vdf_io.export_vdf")
print(f"Supported databases: {list(slug_to_export.keys())}")
# e.g. ['pinecone', 'qdrant', 'milvus', 'vertexai_vector_search', ...]
# Get the Pinecone export classmethod
pinecone_export = slug_to_export["pinecone"]
Related Pages
Implements Principle
Requires Environment
Related Implementations
- Uses Implementation:AI_Northstar_Tech_Vector_io_ExportVDB (instantiates export subclasses)
- Uses Implementation:AI_Northstar_Tech_Vector_io_Push_To_Hub (optional upload step)
- Uses Implementation:AI_Northstar_Tech_Vector_io_Set_Arg_From_Input (credential prompting in subparsers)