pst
Microsoft-PST-Dateien vor Ort lesen und bearbeiten, mit umfangreichen Schemas für gängige MAPI-Typen (E-Mails, Kontakte, Termine, Aufgaben)
Maintainer: mach-kernel
Installation und Laden
INSTALL pst FROM community;LOAD pst;Beispiel
-- Count all messages across PST files (supports globs)D SELECT count(*) FROM read_pst_messages('enron/*.pst');┌────────────────┐│ count_star() ││ int64 │├────────────────┤│ 1227193 │└────────────────┘
-- Query contacts (supports remote URIs)D SELECT given_name, surname FROM read_pst_contacts('https://example.com/outlook.pst');┌────────────┬─────────┐│ given_name │ surname ││ varchar │ varchar │├────────────┼─────────┤│ John │ Doe ││ Jane │ Smith │└────────────┴─────────┘
-- Read messages with limit (applied during planning for large files)D SELECT subject, sender_email_address, message_delivery_time FROM read_pst_messages('*.pst', read_limit=100);
-- Preview an in-place delete. Without `really := true` the call-- opens read-only and reports what it would do per row.D SELECT status, count(*) FROM delete_pst_messages( SELECT pst_path, node_id FROM read_pst_messages('/tmp/hr.pst') WHERE sender_email_address = 'terminated@example.com' ) GROUP BY status;┌───────────┬──────────────┐│ status │ count_star() ││ varchar │ int64 │├───────────┼──────────────┤│ PREVIEWED │ 17 │└───────────┴──────────────┘Über pst
Eine DuckDB-Erweiterung zum Lesen und Bearbeiten von Microsoft-PST-Dateien vor Ort, mit umfangreichen Schemas für gängige MAPI-Typen. Aufgebaut auf Microsofts offiziellem PST SDK. Fragen Sie E-Mails, Kontakte, Termine und mehr ab. Nutzen Sie sie, um PST-Daten vor Ort zu analysieren (lokal oder auf Object Storage), in DuckDB-Tabellen zu importieren, nach Parquet zu exportieren oder Einträge vor Ort zu löschen, um PII zu entfernen, nicht relevante Custodian-Mail vor einer Production auszuschließen oder Anhänge zu entfernen.
Tabellenfunktionen
| Function | MAPI Class | Description |
|---|---|---|
read_pst_folders |
* |
Folder hierarchy |
read_pst_messages |
* |
All messages with base IPM.Note schema |
read_pst_notes |
IPM.Note |
Email messages |
read_pst_contacts |
IPM.Contact |
Contacts with 78+ fields |
read_pst_distribution_lists |
IPM.DistList |
Distribution lists with members |
read_pst_appointments |
IPM.Appointment |
Calendar appointments and meetings |
read_pst_sticky_notes |
IPM.StickyNote |
Sticky note items |
read_pst_tasks |
IPM.Task |
Task items |
Löschen vor Ort
| Function | Input Table | Deletes |
|---|---|---|
delete_pst_messages |
(pst_path VARCHAR, node_id UINTEGER) |
One message, and its attachments |
delete_pst_folders |
(pst_path VARCHAR, node_id UINTEGER) |
A folder, its subfolders and everything in them |
delete_pst_attachments |
(pst_path VARCHAR, message_node_id UINTEGER, attachment_node_id UINTEGER) |
One attachment, leaving the message |
wipe_pst_free_space |
a path or glob | Overwrites bytes no node points at |
Hinter SET pst_allow_delete = true (Sitzung) plus really := true pro Aufruf gesperrt. Ohne really öffnet der Aufruf schreibgeschützt, löst jedes Ziel auf und meldet PREVIEWED oder FAILED pro Zeile. Bindungsfehler brechen die Anweisung ab; später Gefundenes wird pro Zeile gemeldet, damit ein Fehler mitten in der Anweisung keine bereits festgeschriebenen Löschungen ohne Protokoll hinterlässt. Node-IDs werden gegen den Modus geprüft, sodass delete_pst_messages einen Ordner oder die Store-Wurzel ablehnt.
Leistungsmerkmale
- Query-Pushdown: Projektions- und Statistik-Pushdown
- Nebenläufige Planung: parallele Partitionsplanung für Verzeichnisse mit vielen PST-Dateien
- Späte Materialisierung: Filter auf virtuellen Spalten, bevor volle Projektionen expandiert werden
Parameter
| Parameter | Default | Description |
|---|---|---|
read_body_size_bytes |
1000000 |
Max bytes to read into body/body_html (0 for unlimited) |
read_attachment_body |
false |
Whether to read attachment bytes |
read_limit |
NULL |
Max items to read (applied during planning) |
Vollständige Schema-Dokumentation und Nutzungsbeispiele finden Sie im GitHub-Repository.
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| delete_pst_attachments | table | NULL | NULL | |
| delete_pst_folders | table | NULL | NULL | |
| delete_pst_messages | table | NULL | NULL | |
| read_pst_appointments | table | NULL | NULL | |
| read_pst_contacts | table | NULL | NULL | |
| read_pst_distribution_lists | table | NULL | NULL | |
| read_pst_folders | table | NULL | NULL | |
| read_pst_messages | table | NULL | NULL | |
| read_pst_notes | table | NULL | NULL | |
| read_pst_sticky_notes | table | NULL | NULL | |
| read_pst_tasks | table | NULL | NULL | |
| wipe_pst_free_space | table | 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
| name | description | input_type | scope | aliases |
|---|---|---|---|---|
| pst_allow_delete | Allow delete_pst_* and wipe_pst_free_space to edit PST files in place. Deletion cannot be undone. | BOOLEAN | GLOBAL | [] |