plexos2duckdb 0.1.0-beta.7

A tool to convert PLEXOS Solution files to a DuckDB database.
Documentation

plexos2duckdb

Release License Platform Downloads

This is a command line tool to convert PLEXOS solution files to a DuckDB database.

Installation

Option 1: Install with pip

On supported platforms, you can install the command-line tool directly with pip:

pip install plexos2duckdb

Then verify the install:

plexos2duckdb --version

Note that this requires a published wheel for your platform.

Basic Python usage:

from plexos2duckdb import PLEXOS2DuckDB

client = PLEXOS2DuckDB("Model DAY_AHEAD Solution.zip")
output_path = client.convert()

with client as db:
    rows = db.query("SELECT COUNT(*) FROM information_schema.tables")

Option 2: Download prebuilt binary

Prebuilt binaries are available from the GitHub Releases page.

  1. Go to the latest release page on GitHub.

  2. Download the appropriate binary for your operating system.

  3. Extract the archive:

    tar -xzf plexos2duckdb-<platform>.tar.gz
    

    or on Windows:

    Expand-Archive plexos2duckdb-<platform>.zip -DestinationPath .
    
  4. Copy the binary to a directory in your PATH, e.g.:

    # MacOS/Linux
    cp plexos2duckdb ~/local/bin/
    # Windows
    copy plexos2duckdb.exe %USERPROFILE%\local\bin\
    

    You will have to make sure ~/local/bin/ is in your PATH.

Option 3: Build from Source

If you prefer to build from source, ensure you have Rust and Cargo installed.

  1. Clone the repository:

    git clone https://github.com/epri-dev/plexos2duckdb.git
    cd plexos2duckdb
    
  2. Build the binary:

    cargo build --release
    

    The compiled binary will be located at:

    target/release/plexos2duckdb
    
  3. Copy the binary to a directory in your PATH:

    # MacOS/Linux
    cp target/release/plexos2duckdb ~/local/bin/
    # Windows
    copy target\release\plexos2duckdb.exe %USERPROFILE%\local\bin\
    

    You will have to make sure ~/local/bin/ is in your PATH.

Quickstart

Verify installation is successful by checking the version:

plexos2duckdb --version

Run the help command to see available options:

plexos2duckdb --help

Convert a solution zip file to a duckdb database:

plexos2duckdb convert --input "Model-DayAhead-Solution.zip" --output "Model-DayAhead-Solution.duckdb"

If the output database already exists, re-run with --force to overwrite it:

plexos2duckdb convert --input "Model-DayAhead-Solution.zip" --output "Model-DayAhead-Solution.duckdb" --force

Inspect an existing database to view metadata, source file info, model name, and table inventory with row counts:

plexos2duckdb inspect --input "Model-DayAhead-Solution.duckdb"

For machine-readable diagnostics in automation or CI, use JSON output:

plexos2duckdb inspect --input "Model-DayAhead-Solution.duckdb" --format-diagnostics json
plexos2duckdb convert --input "Model-DayAhead-Solution.zip" --output "Model-DayAhead-Solution.duckdb" --format-diagnostics json

Generate shell completions to stdout with the generate-shell-completions subcommand:

plexos2duckdb generate-shell-completions bash > ~/.local/share/bash-completion/completions/plexos2duckdb
plexos2duckdb generate-shell-completions zsh > ~/.zfunc/_plexos2duckdb

You may use any duckdb compatible database viewer to interactively explore the data with SQL: