Read files within zip archives
Maintainer(s):
isaacbrodsky
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL zipfs FROM community;
LOAD zipfs;
Example
SELECT * FROM 'zip://my_zip.zip/my_file.csv';
About zipfs
The zipfs extension adds support for reading files from within zip files and other archives.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| archive_contents | table | Returns a table of the files in the archive. | NULL | [SELECT * FROM archive_contents('example.zip');, SELECT file_name, file_size, is_directory, is_encrypted FROM archive_contents('example.zip');] |
| zip_contents | table | Returns a table of the files in the zip archive. | NULL | [SELECT * FROM zip_contents('example.zip');, SELECT file_name, file_size, is_directory, is_encrypted FROM zip_contents('example.zip');] |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |
| zipfs_extension | Extension to look for splitting the zip path and the file path within the zip. To specify an artificial seperator, instead set: set zipfs_split = '!!'; |
VARCHAR | GLOBAL | [] | .zip |
| zipfs_split | Extension to look for splitting the zip path and the file path within the zip. Will be removed from the zip file name. Overrides zipfs_extension. Defaults to NULL. | VARCHAR | GLOBAL | [] | NULL |