matlab-use-duckdb

Generate MATLAB code for DuckDB SQL queries on local data files.

883|109|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-use-duckdb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: matlab-use-duckdb
Source: https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/reporting-and-database-access/matlab-use-duckdb
Command: npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-use-duckdb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you avoid slow and memory-heavy MATLAB data pipelines by generating correct DuckDB-backed MATLAB code that performs filtering, aggregation, and file-to-table analytics directly in SQL.

Core Features & Use Cases

  • DuckDB connection guidance: Uses duckdb() (optionally file-backed) with proper isopen(conn) verification and safe closing via close(conn).
  • File analytics pushdown: Uses fetch with SQL read_csv/read_parquet/read_xlsx patterns to prevent the load-then-query anti-pattern.
  • In-database workflows: Supports creating portable development databases via duckdb("file.duckdb"), importing with sqlwrite, and querying with sqlread or complex SQL via fetch.
  • Extensions support: Installs and loads extensions (e.g., excel) when the query requires them.
  • Guardrails and correctness: Warns against unsupported patterns such as databasePreparedStatement for DuckDB and encourages reserved-keyword-safe column handling (e.g., using renamevars).

Quick Start

Ask the agent to generate a DuckDB-powered MATLAB solution that queries your large CSV or Parquet file directly with SQL filtering and aggregation using fetch and read_csv or read_parquet.

Frequently Asked Questions about matlab-use-duckdb

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query large CSV or Parquet files in MATLAB without running out of memory?

To query large files out-of-memory in MATLAB, use DuckDB SQL with the fetch function and read_csv or read_parquet patterns. This pushes filtering and aggregation directly to the file, preventing the memory-heavy load-then-query anti-pattern.

Does Database Toolbox support DuckDB for SQL file analytics in MATLAB?

Yes, Database Toolbox R2026a+ supports DuckDB for SQL file analytics. You connect using the duckdb() function, verify the connection with isopen(conn), and execute file-based SQL queries to analyze large datasets directly.

What is the best way to run out-of-memory data preprocessing on Excel files in MATLAB?

The best way to run out-of-memory preprocessing on Excel files is using DuckDB via MATLAB. You install and load the excel extension within your DuckDB session, then use SQL read_xlsx patterns with fetch to filter data before loading.

How do I create a portable development database using DuckDB in MATLAB?

To create a portable development database in MATLAB, connect using duckdb("file.duckdb") to establish a file-backed connection. You can then import datasets using sqlwrite and query the persistent database using sqlread or complex SQL via fetch.

Why should I use fetch instead of sqlread when querying external files with DuckDB in MATLAB?

You should use fetch instead of sqlread for querying external files because fetch executes SQL read_csv, read_parquet, or read_xlsx patterns directly. This applies SQL pushdown to filter and aggregate file data, whereas sqlread is for reading tables already imported into the database.

What limitations should I avoid when using DuckDB with MATLAB Database Toolbox?

When using DuckDB with MATLAB, avoid unsupported patterns like databasePreparedStatement. Additionally, handle reserved SQL keywords safely by using renamevars for column names, and always close your connections with close(conn) to prevent resource leaks.