Skip to content

MatthewMooreZA/mpduck

Repository files navigation

mpduck

A DuckDB extension for reading and writing FIS Prophet model point files (.rpt, .prn, .fac).

Installation

INSTALL mpduck FROM community;
LOAD mpduck;

Reading files

Reference a .rpt, .prn, or .fac file directly in a FROM clause:

SELECT * FROM 'model_points.rpt';
SELECT * FROM 'data/*.rpt';
SELECT * FROM 'data/*.fac';

Or use read_mpfile() explicitly:

-- Single file or glob
SELECT * FROM read_mpfile('model_points.rpt');
SELECT * FROM read_mpfile('data/*.rpt');

-- Multiple files or globs
SELECT * FROM read_mpfile(['mp_2024.rpt', 'mp_2025.rpt']);
SELECT * FROM read_mpfile(['region_a*.rpt', 'region_b*.rpt']);

Writing files

-- The format is auto-detected from the .rpt, .prn, or .fac extension
COPY (SELECT * FROM my_table) TO 'output.rpt';
COPY (SELECT * FROM my_table) TO 'output.prn';
COPY (SELECT * FROM my_table) TO 'output.fac';

-- FORMAT mpfile can also be specified explicitly
COPY (SELECT * FROM my_table) TO 'output.rpt' (FORMAT mpfile);

KV_METADATA

Use KV_METADATA to embed key-value metadata rows at the top of the file (before the schema row). The value is a struct of string key-value pairs:

COPY (SELECT * FROM my_table) TO 'output.rpt' (
    KV_METADATA {run_date: '2024-01-01', version: '1.0'}
);

INCLUDE_TYPES

Controls whether the VARIABLE_TYPES schema row is written. Defaults to true.

Set to false to omit the VARIABLE_TYPES row — useful when the consuming application does not expect it:

COPY (SELECT * FROM my_table) TO 'output.rpt' (INCLUDE_TYPES false);

Building from source

git clone --recurse-submodules https://github.com/your-org/mpduck
cd mpduck
make

Run tests:

make test

About

DuckDB extension to read and write Prophet model point files.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Generated from duckdb/extension-template