---
title: "Extracting, Converting, and Querying Data in Local Files using clickhouse-local"
description: "clickhouse-local runs ClickHouse's SQL engine as a standalone CLI, so you can query, transform and convert local, piped, HTTP, S3, MySQL or Postgres data without deploying a server."
url: "https://swe.quest/articles/extracting-converting-and-querying-data-in-local-files-using-clickhouse-local-46ff61f0273cc3b7"
canonical: "https://clickhouse.com/blog/extracting-converting-querying-local-files-with-sql-clickhouse-local"
source: "ClickHouse"
published: "2023-01-04"
difficulty: "medium"
kind: "How-to"
reading_minutes: 13
tags: ["analytics","sql","data-pipelines","developer-tools"]
---

# Extracting, Converting, and Querying Data in Local Files using clickhouse-local

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2023-01-04, 13 min read, How-to. Original: [https://clickhouse.com/blog/extracting-converting-querying-local-files-with-sql-clickhouse-local](https://clickhouse.com/blog/extracting-converting-querying-local-files-with-sql-clickhouse-local)

## Summary

clickhouse-local runs ClickHouse's SQL engine as a standalone CLI, so you can query, transform and convert local, piped, HTTP, S3, MySQL or Postgres data without deploying a server. Worked examples cover querying CSVs with or without headers via the file() function, schema inference with DESCRIBE, and writing results with INTO OUTFILE in formats such as SQLInsert and Parquet. They also show globbing and joining multiple files, the virtual \_file/\_path columns, and stdin piping with --structure. Compressed multi-gigabyte files are handled with automatic compression detection, and a 826K CSV shrinks to 432K as Parquet.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)
- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Developer tools](https://swe.quest/tags/developer-tools.md) (Engineering practices)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- CSV and Parquet file formats
- command-line usage

## Keywords

clickhouse-local, ClickHouse, Parquet, CSV, S3, MySQL, PostgreSQL

## Related posts

- [An Introduction to Data Formats in ClickHouse](https://swe.quest/articles/an-introduction-to-data-formats-in-clickhouse-9760492f888ea4b5.md): ClickHouse · 2023-01-24 · Medium · 6 min read · Analytics & OLAP, Data pipelines, Databases
  ClickHouse can import and export a wide range of formats through the FORMAT clause and related settings.
- [A Deep Dive into Apache Parquet with ClickHouse - Part 1](https://swe.quest/articles/a-deep-dive-into-apache-parquet-with-clickhouse-part-1-cafa50694ad68bf6.md): ClickHouse · 2023-04-18 · Medium · 11 min read · Analytics & OLAP, Data pipelines, SQL
  ClickHouse can read and write Apache Parquet through its file and s3 table functions, using the same Parquet code in ClickHouse Local and ClickHouse Server.
- [Getting Data Into ClickHouse - Part 1](https://swe.quest/articles/getting-data-into-clickhouse-part-1-31fa78b8cfd1bb8c.md): ClickHouse · 2022-08-26 · Medium · 11 min read · Analytics & OLAP, SQL, Databases
  ClickHouse can load a 28.7M-row, 4.6GB gzipped Hacker News CSV with a single command, using schema inference via clickhouse-local's file() and the url() table function.
- [Getting Data Into ClickHouse - Part 3 - Using S3](https://swe.quest/articles/getting-data-into-clickhouse-part-3-using-s3-3c57bebcb705e26d.md): ClickHouse · 2022-09-16 · Medium · 21 min read · Analytics & OLAP, SQL, Cloud platforms, Performance engineering, Data pipelines
  ClickHouse can both query data in place on Amazon S3 and ingest it, shown here on an 11.5-billion-row, ~600GB forex tick dataset stored as zstd CSV and Parquet.
- [Loading Parquet data into MySQL with ClickHouse](https://swe.quest/articles/loading-parquet-data-into-mysql-with-clickhouse-e9a6bbccc1c8e2b3.md): ClickHouse · 2026-09-10 · Medium · 6 min read · MySQL, Data pipelines, SQL
  MySQL has no native Parquet import, but clickhouse-local can read a Parquet file over HTTP with the \`url\` table function and write it straight into a MySQL table via \`INSERT INTO FUNCTION mysql(...)\`.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
