Urgent.News

What's breaking now, across thousands of outlets.

Tech

How to Set Up DuckDB (Run SQL on a CSV With No Import Step)

By Michael Nocito , data analyst · Published August 8, 2026 By the end of this page you will be running SQL directly against a CSV file on your machine, with no import step, no CREATE TABLE , and no schema written by hand. DuckDB reads the file where it lies, works out the column types itself, and gives you a normal SQL result. It takes one command to install and about a minute to prove. Here is…

DuckDB is a software library that allows running SQL queries directly on a CSV file without the need for any additional import steps. It automatically detects column types and provides a normal SQL result. To get started, install DuckDB using the command `python -m pip install duckdb`. Then, you can query the CSV file by writing a SQL query with the filename in quotes where a table name would typically go.

For example, to select the top 5 countries by revenue from a CSV file named "invoices.csv", use the following command: `SELECT Country, COUNT(*) AS invoices, ROUND(SUM(Total), 2) AS revenue FROM invoices.csv GROUP BY Country ORDER BY revenue DESC LIMIT 5`.

DuckDB infers the column types from the file contents, which can be verified using the `DESCRIBE` command. This feature extends beyond single files and can handle an entire folder of CSV files as one table by using an asterisk (*) in the filename. This eliminates the need for loops or manual concatenation of files. Additionally, DuckDB can interface with pandas, allowing seamless integration with data analysis workflows.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

The Pipeline Worked. Then the Research Outgrew It.

About a year ago, I was building a terminal-based workflow manager called Glyph.Flow. It was mostly a learning project. I wanted to understand Python better, experiment with Textual, think about…

  • Glyph.Flow started as a terminal-based workflow manager for a learning project.
  • Research pipeline proved effective for Master's thesis data processing.
  • PhD research required adaptable infrastructure for evolving questions and datasets.

I built a zero-dependency CLI that crawls your site and lints its JSON-LD

Structured data breaks silently: the page renders fine while your Product schema has "$19.99" as a price, your LocalBusiness lost its address in a redesign, and your breadcrumbs go 1, 3.

  • schema-audit is a single-file Node.js CLI tool
  • Crawls entire site to check JSON-LD issues
  • Zero npm dependencies for lightweight solution

More from Saturday 29 August →