hostfs
Das Dateisystem mit SQL durchsuchen und erkunden
Maintainer: Gropaul
Installation und Laden
INSTALL hostfs FROM community;LOAD hostfs;Beispiel
-- Navigate to the workspace and list the filesD PRAGMA cd('/Users/paul/workspace');D PRAGMA ls;┌───────────────────────────────┐│ path ││ varchar │├───────────────────────────────┤│ ./duckdb ││ ./playground ││ ./hostfs │-- Find the files you were working on lastD SELECT path, file_last_modified(path) AS date FROM ls() WHERE 'csv' IN file_extension(path) ORDER BY date LIMIT 1 ;┌───────────────────────────┬─────────────────────┐│ path │ date ││ varchar │ timestamp │├───────────────────────────┼─────────────────────┤│ ./sketch_results_join.csv │ 2024-07-13 23:25:48 │└───────────────────────────┴─────────────────────┘-- List the top 3 file types by total size, with file count, ordered by size.D SELECT size, count, file_extension AS "type"FROM (SELECT SUM(file_size(path)) AS size_raw, format_bytes(size_raw) AS size, COUNT(*) AS count, file_extension(path) AS file_extensionFROM lsr('/Users/paul/workspace', 10)GROUP BY file_extension(path)) AS subqueryORDER BY size_raw DESC LIMIT 3;┌───────────┬───────┬─────────┐│ size │ count │ type ││ varchar │ int64 │ varchar │├───────────┼───────┼─────────┤│ 246.95 GB │ 29 │ .duckdb ││ 90.33 GB │ 3776 │ .tmp ││ 26.17 GB │ 28175 │ .csv │└───────────┴───────┴─────────┘Über hostfs
Die HostFS-Erweiterung ermöglicht es Ihnen, das Dateisystem mit SQL zu durchsuchen und zu erkunden. Sie stellt Funktionen bereit, um Dateien aufzulisten, Dateimetadaten abzurufen und mehr. Weitere Informationen finden Sie in der HostFS-Dokumentation.
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| absolute_path | scalar | NULL | NULL | |
| cd | pragma | NULL | NULL | |
| cd | table | NULL | NULL | |
| file_extension | scalar | NULL | NULL | |
| file_last_modified | scalar | NULL | NULL | |
| file_name | scalar | NULL | NULL | |
| file_size | scalar | NULL | NULL | |
| hostfs | scalar | NULL | NULL | |
| hsize | scalar | NULL | NULL | |
| is_dir | scalar | NULL | NULL | |
| is_file | scalar | NULL | NULL | |
| ls | pragma | NULL | NULL | |
| ls | table | NULL | NULL | |
| lsr | pragma | NULL | NULL | |
| lsr | table | NULL | NULL | |
| path_exists | scalar | NULL | NULL | |
| path_separator | scalar | NULL | NULL | |
| path_split | macro | NULL | NULL | |
| path_type | scalar | NULL | NULL | |
| pwd | pragma | NULL | NULL | |
| pwd | scalar | NULL | NULL |
Überladene Funktionen
Diese Erweiterung fügt keine Funktionsüberladungen hinzu.
Hinzugefügte Typen
Diese Erweiterung fügt keine Typen hinzu.
Hinzugefügte Einstellungen
Diese Erweiterung fügt keine Einstellungen hinzu.