Install and load
Run these commands in a Haybarn SQL session. The extension is available from the community repository.
INSTALL read_lines FROM community;
LOAD read_lines FROM community;
Try it in a temporary SQL session with read_lines already loaded. Queries run in this tab; examples using files or services need their own setup.
Using upstream DuckDB? Follow the maintainer’s installation instructions.
Usage example
Read all lines from a file
-- Read all lines from a file
SELECT * FROM read_lines('server.log');
-- Read specific lines (positional argument)
SELECT * FROM read_lines('server.log', '100-200');
-- Read lines with context around matches
SELECT * FROM read_lines('error.log', 42, context := 3);
-- Path-embedded line selection
SELECT * FROM read_lines('error.log:42 +/-3');
-- Last 10 lines (from-end syntax)
SELECT * FROM read_lines('app.log', '+10-');
-- Glob pattern to read from multiple files
SELECT * FROM read_lines('logs/*.log')
WHERE content LIKE '%ERROR%';
-- Parse lines from a string
SELECT * FROM parse_lines('line1
line2
line3');
Provided by teaguesterling. Not yet verified on Haybarn 2.0.0.
Sample data & setupAbout this extension
The read_lines extension provides functions for reading line-based text files with precise control over which lines to extract.
Sources may be non-seekable (pipes/streams, e.g. shellfs commands), including per-row commands in a correlated lateral join.
Project overview from the community descriptor.
Documentation and resources
Project and build details
- Repository
- teaguesterling/duckdb_read_lines
- License
- MIT
- Maintainers
- teaguesterling
- Written in
- C++
- Build source
63d27fec46a4- Build definition
- Community descriptor