laterite_ags4
AGS4-Geotechnikdateien als typisierte, UUID-schlüsselte Tabellen direkt aus SQL lesen — born-typed Spalten, deterministische inhaltsadressierte Schlüssel, die Gruppen konstruktionsbedingt verbinden, und ein eingebettetes AGS-Wörterbuch. Eine schreibgeschützte SQL-Oberfläche. Lokal, http(s):// und s3:// (mit httpfs).
Maintainer: niko86
Installation und Laden
INSTALL laterite_ags4 FROM community;LOAD laterite_ags4;Beispiel
-- Read a group as a typed table (columns typed from the file's own TYPE row):SELECT loca_id, loca_glFROM read_ags('site.ags', 'LOCA')WHERE loca_gl > 50.0;
-- Join across groups on the deterministic keys — no shared state, joins by-- construction (every SAMP row's _parent_id equals its LOCA's _id):SELECT l.loca_id, s.samp_ref, s.samp_topFROM read_ags('site.ags', 'SAMP') sJOIN read_ags('site.ags', 'LOCA') l ON s._parent_id = l._id;
-- Inspect structure + the embedded AGS dictionary:SELECT "group", n_rows, parent FROM ags_groups('site.ags') ORDER BY n_rows DESC;SELECT child, parent, shared_keys FROM ags_relationships() WHERE parent = 'LOCA';
-- Remote, lazily (with httpfs):-- LOAD httpfs;-- SELECT loca_id FROM read_ags('s3://bucket/site.ags', 'LOCA');Über laterite_ags4
laterite_ags4 liest geotechnische und geoökologische AGS4-
Datendateien als erstklassige DuckDB-Tabellen — ohne Konvertierungsschritt, ohne gebündelte Engine.
Geschrieben in 🦀 Rust auf der C-Erweiterungs-API von DuckDB (ohne C++).
Was Sie erhalten
- Born-typed Spalten — jede Überschrift wird aus der eigenen
TYPE-Zeile der Datei typisiert (2DP→DOUBLE,ID→VARCHAR,0DP→BIGINT,YN→BOOLEAN, …). - Deterministische inhaltsadressierte Schlüssel — jede Zeile trägt
_idund_parent_id(UUIDv8 der Spezifikations-Schlüsselkette der Zeile).child._parent_id == parent._idkonstruktionsbedingt, sodass Gruppen über unabhängigeread_ags(...)-Aufrufe ohne gemeinsamen Zustand verbunden werden. - Selbstbeschreibende Metadaten —
ags_groups,ags_headings,ags_dictionary,ags_relationshipslegen die Dateistruktur und das eingebettete AGS-Wörterbuch offen. - Persistenz —
load_ags(path)erzeugt CREATE-TABLE-DDL für einen indizierten, wiederholt und remote abfragbaren Speicher. - Lokal oder remote — Lesevorgänge laufen über das virtuelle Dateisystem von DuckDB, sodass lokale Pfade,
http(s)://unds3://(mitLOAD httpfs) alle auf demselben Codepfad funktionieren. - Nativ + wasm — gebaut für jede Community-Extensions-Plattform, einschließlich DuckDB-WASM: derselbe Reader für natives und Browser-DuckDB.
Functions
| function | returns |
|---|---|
read_ags(path, group) |
one group as a typed table — _id, _parent_id, then one column per heading (typed from the file’s TYPE row). Reads local / http(s):// / s3://. |
read_ags_text(content, group) |
the same typed table, from an inline AGS4 string (no filesystem). |
ags_groups(path) |
(group, n_rows, n_headings, parent) — the file’s group list. |
ags_headings(path) |
(group, heading, unit, ags_type, sql_type, status, is_key, ordinal) — the per-heading schema, enriched with the dictionary’s KEY status. |
ags_dictionary() |
the embedded standard AGS dictionary as a table (group, heading, status, ags_type, unit, description, …). |
ags_relationships() |
(child, parent, shared_keys) — the spec parent→child graph that _parent_id follows. |
ags_rules() |
the AGS4 numbered-rule catalogue (rule, title, severity, fixable) — the extension lists the rules; the CLI/library run them. |
load_ags(path) |
(seq, stmt) — CREATE-TABLE DDL to materialise every group into an indexed, repeat-/remote-queryable store. |
Reader streamen verzögert (Vektorchunks mit ≈2048 Zeilen); eine nicht konforme numerische Zelle wird
NULL, niemals ein Fehler (das born-typed Verhalten). Optionale Argumente sind benannt
(edition := '4.2', encoding := 'windows-1252'), der Rest ist positional. Die Pfadvarianten
nehmen einen benannten Parameter encoding (z. B. encoding := 'windows-1252') für Nicht-UTF-8-
Quellen; die Variante _text ist UTF-8 (ihre Eingabe ist bereits ein VARCHAR). Dies ist eine
schreibgeschützte SQL-Oberfläche — Validierung, Zertifizierung und Reparatur bleiben in der lat-
CLI / der Bibliothek laterite.
Hinzugefügte Funktionen
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| read_ags | table | Read one AGS4 group as a typed table — born-typed columns plus content-addressed _id/_parent_id keys | Local / http(s):// / s3:// (with LOAD httpfs); consumes a sibling .ags.idx for a fast single-group slice | [SELECT loca_id, loca_gl FROM read_ags(‘site.ags’, ‘LOCA’);] |
| read_ags_text | table | Read one AGS4 group as a typed table from an inline AGS4 string | No filesystem — the input is a VARCHAR (already UTF-8) | [SELECT * FROM read_ags_text(ags_string, ‘LOCA’);] |
| ags_groups | table | List the groups in an AGS4 file with row and heading counts | Returns (group, n_rows, n_headings, parent) | [SELECT * FROM ags_groups(‘site.ags’);] |
| ags_headings | table | The per-heading schema of an AGS4 file, enriched with dictionary KEY status | Returns (group, heading, unit, ags_type, sql_type, status, is_key, ordinal) | [SELECT * FROM ags_headings(‘site.ags’) LIMIT 5;] |
| ags_dictionary | table | The embedded standard AGS dictionary as a table | Returns (group, heading, status, ags_type, unit, description) | [SELECT * FROM ags_dictionary() LIMIT 5;] |
| ags_relationships | table | The AGS group parent-child (KEY) graph that _parent_id follows | Returns (child, parent, shared_keys) | [SELECT * FROM ags_relationships();] |
| ags_rules | table | The AGS4 numbered-rule catalogue | Returns (rule, title, severity, fixable) — the extension lists the rules; the CLI and libraries run them | [SELECT * FROM ags_rules() WHERE fixable;] |
| load_ags | table | Emit CREATE-TABLE DDL to materialise every AGS4 group into an indexed, queryable store | Returns (seq, stmt) — run the statements to get keyed tables | [SELECT stmt FROM load_ags(‘site.ags’) ORDER BY seq;] |
| to_duckdb | table | Emit ATTACH/CREATE-TABLE/DETACH DDL to persist every AGS4 group as a standalone .duckdb file | Returns (seq, stmt); the file matches the libraries’ to_duckdb() output — keyed by _id/_parent_id | [SELECT stmt FROM to_duckdb(‘site.ags’, ‘site.duckdb’) ORDER BY seq;] |
Ü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.