drb-iceberg 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1,2 @@
1
+ include versioneer.py
2
+ include drb/iceberg/_version.py
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: drb-iceberg
3
+ Version: 0.2.0
4
+ Summary: DRB Iceberg add-on
5
+ Author: GAEL Systems
6
+ Author-email: drb-python@gael.fr
7
+ License: LGPLv3
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Environment :: Plugins
12
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENCE.txt
16
+ Requires-Dist: drb<3,>=2.2
17
+ Requires-Dist: drb-metadata<2,>=1.4
18
+ Requires-Dist: drb-extractor~=1.3.0
19
+ Dynamic: license-file
20
+
21
+ # drb-iceberg
22
+
23
+ **Purpose:** Turn a product topic's `iceberg:` ontological configuration into a declarative `IcebergMapping` that describes table name, partitions, column extractors, and derived sub-tables. The add-on performs planning only — no Iceberg catalog I/O.
24
+
25
+ ## Contract
26
+
27
+ `IcebergAddon.apply(node, topic=None, **kwargs)` returns an `IcebergMapping` object containing:
28
+ - `table`: main table name (string)
29
+ - `ingestible`: ingestion enabled (boolean)
30
+ - `ingest_priority`: optional priority level (int or None)
31
+ - `identifier`: unique key extractor (XQuery-based, not executed)
32
+ - `partitions`: list of partition field definitions
33
+ - `columns`: column schema with row extractors (delegated to `drb-metadata`)
34
+ - `derived`: list of derived (sub-)table definitions
35
+
36
+ The mapping is declarative: extractors are not executed by the add-on. A separate consumer processes the plan and executes row extraction/table writes.
37
+
38
+ ## Dependencies
39
+
40
+ - `drb>=2.2,<3`
41
+ - `drb-metadata>=1.4,<2` — provides column extraction via `extract_for_class(class_uri, graph)`
42
+
43
+ ## The `iceberg:` vocabulary
44
+
45
+ Attached to a product topic at namespace `http://www.gael.fr/iceberg#`:
46
+
47
+ | Term | Cardinality | Type | Meaning |
48
+ |---|---|---|---|
49
+ | `ingestible` | 1 | xs:boolean | Enables ingestion for this topic. |
50
+ | `targetTable` | 1 | string | Main table name, e.g. `sentinel1.products`. |
51
+ | `ingestPriority` | 0..1 | xs:int | Ingestion priority. |
52
+ | `identifier` | 1 | XQuery | Unique key of the product row. |
53
+ | `partitionStrategy` | 0..n | PartitionStrategy | Partition field/transform/order. |
54
+ | `derivedTable` | 0..n | DerivedTable | Sub-table definition. |
55
+
56
+ ### PartitionStrategy
57
+
58
+ - `partitionField` (string) — field name
59
+ - `partitionTransform` (string: `identity`, `year`, `month`, `day`, etc.)
60
+ - `partitionOrder` (xs:int) — sort order
61
+
62
+ ### DerivedTable
63
+
64
+ - `tableName` (string) — suffix appended to main table with a dot
65
+ - `entityListExtractor` (XQuery) — yields the list of row nodes
66
+ - `entityClass` (resource) OR `entityMetadataExtractor` (XQuery) — column source (`entityClass` wins if both present)
67
+ - `entityIdentifier` (XQuery) — unique key per row
@@ -0,0 +1,47 @@
1
+ # drb-iceberg
2
+
3
+ **Purpose:** Turn a product topic's `iceberg:` ontological configuration into a declarative `IcebergMapping` that describes table name, partitions, column extractors, and derived sub-tables. The add-on performs planning only — no Iceberg catalog I/O.
4
+
5
+ ## Contract
6
+
7
+ `IcebergAddon.apply(node, topic=None, **kwargs)` returns an `IcebergMapping` object containing:
8
+ - `table`: main table name (string)
9
+ - `ingestible`: ingestion enabled (boolean)
10
+ - `ingest_priority`: optional priority level (int or None)
11
+ - `identifier`: unique key extractor (XQuery-based, not executed)
12
+ - `partitions`: list of partition field definitions
13
+ - `columns`: column schema with row extractors (delegated to `drb-metadata`)
14
+ - `derived`: list of derived (sub-)table definitions
15
+
16
+ The mapping is declarative: extractors are not executed by the add-on. A separate consumer processes the plan and executes row extraction/table writes.
17
+
18
+ ## Dependencies
19
+
20
+ - `drb>=2.2,<3`
21
+ - `drb-metadata>=1.4,<2` — provides column extraction via `extract_for_class(class_uri, graph)`
22
+
23
+ ## The `iceberg:` vocabulary
24
+
25
+ Attached to a product topic at namespace `http://www.gael.fr/iceberg#`:
26
+
27
+ | Term | Cardinality | Type | Meaning |
28
+ |---|---|---|---|
29
+ | `ingestible` | 1 | xs:boolean | Enables ingestion for this topic. |
30
+ | `targetTable` | 1 | string | Main table name, e.g. `sentinel1.products`. |
31
+ | `ingestPriority` | 0..1 | xs:int | Ingestion priority. |
32
+ | `identifier` | 1 | XQuery | Unique key of the product row. |
33
+ | `partitionStrategy` | 0..n | PartitionStrategy | Partition field/transform/order. |
34
+ | `derivedTable` | 0..n | DerivedTable | Sub-table definition. |
35
+
36
+ ### PartitionStrategy
37
+
38
+ - `partitionField` (string) — field name
39
+ - `partitionTransform` (string: `identity`, `year`, `month`, `day`, etc.)
40
+ - `partitionOrder` (xs:int) — sort order
41
+
42
+ ### DerivedTable
43
+
44
+ - `tableName` (string) — suffix appended to main table with a dot
45
+ - `entityListExtractor` (XQuery) — yields the list of row nodes
46
+ - `entityClass` (resource) OR `entityMetadataExtractor` (XQuery) — column source (`entityClass` wins if both present)
47
+ - `entityIdentifier` (XQuery) — unique key per row
File without changes
@@ -0,0 +1,21 @@
1
+
2
+ # This file was generated by 'versioneer.py' (0.29) from
3
+ # revision-control system data, or from the parent directory name of an
4
+ # unpacked source archive. Distribution tarballs contain a pre-generated copy
5
+ # of this file.
6
+
7
+ import json
8
+
9
+ version_json = '''
10
+ {
11
+ "date": "2026-06-23T23:42:00+0000",
12
+ "dirty": false,
13
+ "error": null,
14
+ "full-revisionid": "687082d5d551048c28491ed94a1ac2af67a54957",
15
+ "version": "0.2.0"
16
+ }
17
+ ''' # END VERSION_JSON
18
+
19
+
20
+ def get_versions():
21
+ return json.loads(version_json)
@@ -0,0 +1,74 @@
1
+ from typing import Any, Optional, Tuple
2
+
3
+ import rdflib
4
+ from drb.addons.addon import Addon
5
+ from drb.core.node import DrbNode
6
+ from drb.topics.topic import DrbTopic
7
+ from drb.topics.dao import ManagerDao
8
+ import drb.topics.resolver as resolver
9
+ from drb.metadata.core import MetadataAddon, extract_for_class
10
+
11
+ from drb.iceberg import parser
12
+ from drb.iceberg.mapping import IcebergMapping
13
+
14
+
15
+ class IcebergAddon(Addon):
16
+ """Builds a declarative :class:`IcebergMapping` from a topic's
17
+ ``iceberg:`` ontological configuration. Performs no catalog I/O."""
18
+
19
+ @classmethod
20
+ def identifier(cls) -> str:
21
+ return 'iceberg'
22
+
23
+ @classmethod
24
+ def return_type(cls) -> type:
25
+ return IcebergMapping
26
+
27
+ @staticmethod
28
+ def _graph(topic: DrbTopic) -> Optional[rdflib.Graph]:
29
+ try:
30
+ dao = ManagerDao().get_dao(topic.id)
31
+ except Exception:
32
+ return None
33
+ return getattr(dao, 'graph', None)
34
+
35
+ def _ingestion_topic(
36
+ self, topic: DrbTopic, _seen=None
37
+ ) -> Optional[Tuple[DrbTopic, rdflib.Graph]]:
38
+ """Nearest topic (self or ancestor) declaring iceberg:targetTable."""
39
+ if topic is None:
40
+ return None
41
+ if _seen is None:
42
+ _seen = set()
43
+ if topic.id in _seen:
44
+ return None
45
+ _seen.add(topic.id)
46
+ graph = self._graph(topic)
47
+ if (graph is not None and topic.uri is not None
48
+ and parser.read_main_table(graph, topic.uri) is not None):
49
+ return topic, graph
50
+ if topic.subClassOf:
51
+ for parent_id in topic.subClassOf:
52
+ parent = ManagerDao().get_drb_topic(parent_id)
53
+ found = self._ingestion_topic(parent, _seen)
54
+ if found is not None:
55
+ return found
56
+ return None
57
+
58
+ def can_apply(self, source: DrbTopic) -> bool:
59
+ found = self._ingestion_topic(source)
60
+ if found is None:
61
+ return False
62
+ topic, graph = found
63
+ return parser.is_ingestible(graph, topic.uri)
64
+
65
+ def apply(self, node: DrbNode, **kwargs) -> Any:
66
+ topic = kwargs.get('topic') or resolver.resolve(node)[0]
67
+ found = self._ingestion_topic(topic)
68
+ if found is None:
69
+ return None
70
+ ing_topic, graph = found
71
+ columns = MetadataAddon().apply(node, topic=topic)
72
+ return parser.build_mapping(
73
+ graph, ing_topic.uri, columns,
74
+ lambda cls_uri: extract_for_class(cls_uri, graph))
@@ -0,0 +1,38 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import Any, Dict, List, Optional
5
+
6
+ from drb.extractor import Extractor
7
+
8
+
9
+ @dataclass
10
+ class PartitionField:
11
+ """One Iceberg partition column, ordered by ``order``."""
12
+ field: str
13
+ transform: str
14
+ order: int
15
+
16
+
17
+ @dataclass
18
+ class DerivedTableMapping:
19
+ """A sub-table: one row per node yielded by ``entity_list``."""
20
+ name: str
21
+ entity_list: Optional[Extractor]
22
+ entity_identifier: Optional[Extractor]
23
+ columns: Dict[str, Any]
24
+
25
+
26
+ @dataclass
27
+ class IcebergMapping:
28
+ """Declarative ingestion plan.
29
+
30
+ Holds extractors, never materialised rows.
31
+ """
32
+ table: str
33
+ ingestible: bool
34
+ ingest_priority: Optional[int]
35
+ identifier: Optional[Extractor]
36
+ partitions: List[PartitionField]
37
+ columns: Dict[str, Any]
38
+ derived: List[DerivedTableMapping] = field(default_factory=list)
@@ -0,0 +1,119 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any, Callable, Dict, List, Optional
4
+
5
+ import rdflib
6
+ from drb.extractor import XQueryExtractor
7
+ from drb.iceberg.mapping import (
8
+ DerivedTableMapping, IcebergMapping, PartitionField)
9
+ from drb.metadata.core import DrbMetadata
10
+
11
+ ICEBERG_NS = 'http://www.gael.fr/iceberg#'
12
+
13
+ _MAIN_QUERY = '''
14
+ PREFIX iceberg: <http://www.gael.fr/iceberg#>
15
+ SELECT ?table ?ingestible ?priority ?identifier WHERE {
16
+ ?topic iceberg:targetTable ?table .
17
+ OPTIONAL { ?topic iceberg:ingestible ?ingestible }
18
+ OPTIONAL { ?topic iceberg:ingestPriority ?priority }
19
+ OPTIONAL { ?topic iceberg:identifier ?identifier }
20
+ }
21
+ '''
22
+
23
+ _ASK_INGESTIBLE = '''
24
+ PREFIX iceberg: <http://www.gael.fr/iceberg#>
25
+ ASK { ?topic iceberg:ingestible true }
26
+ '''
27
+
28
+ _PART_QUERY = '''
29
+ PREFIX iceberg: <http://www.gael.fr/iceberg#>
30
+ SELECT ?field ?transform ?order WHERE {
31
+ ?topic iceberg:partitionStrategy ?ps .
32
+ ?ps iceberg:partitionField ?field ;
33
+ iceberg:partitionTransform ?transform ;
34
+ iceberg:partitionOrder ?order .
35
+ } ORDER BY ?order
36
+ '''
37
+
38
+
39
+ def is_ingestible(graph: rdflib.Graph, topic_uri: str) -> bool:
40
+ return bool(graph.query(
41
+ _ASK_INGESTIBLE,
42
+ initBindings={'topic': rdflib.URIRef(topic_uri)}).askAnswer)
43
+
44
+
45
+ def read_main_table(
46
+ graph: rdflib.Graph, topic_uri: str) -> Optional[dict]:
47
+ rows = list(graph.query(
48
+ _MAIN_QUERY, initBindings={'topic': rdflib.URIRef(topic_uri)}))
49
+ if not rows or rows[0].table is None:
50
+ return None
51
+ row = rows[0]
52
+ return {
53
+ 'table': str(row.table),
54
+ 'ingestible': (row.ingestible.toPython()
55
+ if row.ingestible is not None else False),
56
+ 'priority': (int(row.priority) if row.priority is not None else None),
57
+ 'identifier': (XQueryExtractor(str(row.identifier))
58
+ if row.identifier is not None else None),
59
+ }
60
+
61
+
62
+ def read_partitions(
63
+ graph: rdflib.Graph, topic_uri: str) -> List[PartitionField]:
64
+ rows = graph.query(
65
+ _PART_QUERY, initBindings={'topic': rdflib.URIRef(topic_uri)})
66
+ return [PartitionField(str(r.field), str(r.transform), int(r.order))
67
+ for r in rows]
68
+
69
+
70
+ _DERIVED_QUERY = '''
71
+ PREFIX iceberg: <http://www.gael.fr/iceberg#>
72
+ SELECT ?name ?listx ?cls ?metax ?idx WHERE {
73
+ ?topic iceberg:derivedTable ?dt .
74
+ ?dt iceberg:tableName ?name .
75
+ OPTIONAL { ?dt iceberg:entityListExtractor ?listx }
76
+ OPTIONAL { ?dt iceberg:entityClass ?cls }
77
+ OPTIONAL { ?dt iceberg:entityMetadataExtractor ?metax }
78
+ OPTIONAL { ?dt iceberg:entityIdentifier ?idx }
79
+ }
80
+ '''
81
+
82
+
83
+ def read_derived(
84
+ graph: rdflib.Graph, topic_uri: str
85
+ ) -> List[rdflib.query.ResultRow]:
86
+ return list(graph.query(
87
+ _DERIVED_QUERY, initBindings={'topic': rdflib.URIRef(topic_uri)}))
88
+
89
+
90
+ def build_mapping(
91
+ graph: rdflib.Graph,
92
+ topic_uri: str,
93
+ columns: Dict[str, Any],
94
+ class_columns: Callable[[str], Dict[str, Any]],
95
+ ) -> Optional['IcebergMapping']:
96
+ main = read_main_table(graph, topic_uri)
97
+ if main is None:
98
+ return None
99
+ derived = []
100
+ for r in read_derived(graph, topic_uri):
101
+ suffix = str(r.name)
102
+ full = '%s.%s' % (main['table'], suffix)
103
+ entity_list = (XQueryExtractor(str(r.listx))
104
+ if r.listx is not None else None)
105
+ entity_id = (XQueryExtractor(str(r.idx))
106
+ if r.idx is not None else None)
107
+ if r.cls is not None:
108
+ cols = class_columns(str(r.cls))
109
+ elif r.metax is not None:
110
+ cols = {suffix: DrbMetadata(suffix, XQueryExtractor(str(r.metax)))}
111
+ else:
112
+ cols = {}
113
+ derived.append(
114
+ DerivedTableMapping(full, entity_list, entity_id, cols))
115
+ return IcebergMapping(
116
+ table=main['table'], ingestible=main['ingestible'],
117
+ ingest_priority=main['priority'], identifier=main['identifier'],
118
+ partitions=read_partitions(graph, topic_uri),
119
+ columns=columns, derived=derived)
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: drb-iceberg
3
+ Version: 0.2.0
4
+ Summary: DRB Iceberg add-on
5
+ Author: GAEL Systems
6
+ Author-email: drb-python@gael.fr
7
+ License: LGPLv3
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Programming Language :: Python :: 3.12
10
+ Classifier: Programming Language :: Python :: 3.13
11
+ Classifier: Environment :: Plugins
12
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENCE.txt
16
+ Requires-Dist: drb<3,>=2.2
17
+ Requires-Dist: drb-metadata<2,>=1.4
18
+ Requires-Dist: drb-extractor~=1.3.0
19
+ Dynamic: license-file
20
+
21
+ # drb-iceberg
22
+
23
+ **Purpose:** Turn a product topic's `iceberg:` ontological configuration into a declarative `IcebergMapping` that describes table name, partitions, column extractors, and derived sub-tables. The add-on performs planning only — no Iceberg catalog I/O.
24
+
25
+ ## Contract
26
+
27
+ `IcebergAddon.apply(node, topic=None, **kwargs)` returns an `IcebergMapping` object containing:
28
+ - `table`: main table name (string)
29
+ - `ingestible`: ingestion enabled (boolean)
30
+ - `ingest_priority`: optional priority level (int or None)
31
+ - `identifier`: unique key extractor (XQuery-based, not executed)
32
+ - `partitions`: list of partition field definitions
33
+ - `columns`: column schema with row extractors (delegated to `drb-metadata`)
34
+ - `derived`: list of derived (sub-)table definitions
35
+
36
+ The mapping is declarative: extractors are not executed by the add-on. A separate consumer processes the plan and executes row extraction/table writes.
37
+
38
+ ## Dependencies
39
+
40
+ - `drb>=2.2,<3`
41
+ - `drb-metadata>=1.4,<2` — provides column extraction via `extract_for_class(class_uri, graph)`
42
+
43
+ ## The `iceberg:` vocabulary
44
+
45
+ Attached to a product topic at namespace `http://www.gael.fr/iceberg#`:
46
+
47
+ | Term | Cardinality | Type | Meaning |
48
+ |---|---|---|---|
49
+ | `ingestible` | 1 | xs:boolean | Enables ingestion for this topic. |
50
+ | `targetTable` | 1 | string | Main table name, e.g. `sentinel1.products`. |
51
+ | `ingestPriority` | 0..1 | xs:int | Ingestion priority. |
52
+ | `identifier` | 1 | XQuery | Unique key of the product row. |
53
+ | `partitionStrategy` | 0..n | PartitionStrategy | Partition field/transform/order. |
54
+ | `derivedTable` | 0..n | DerivedTable | Sub-table definition. |
55
+
56
+ ### PartitionStrategy
57
+
58
+ - `partitionField` (string) — field name
59
+ - `partitionTransform` (string: `identity`, `year`, `month`, `day`, etc.)
60
+ - `partitionOrder` (xs:int) — sort order
61
+
62
+ ### DerivedTable
63
+
64
+ - `tableName` (string) — suffix appended to main table with a dot
65
+ - `entityListExtractor` (XQuery) — yields the list of row nodes
66
+ - `entityClass` (resource) OR `entityMetadataExtractor` (XQuery) — column source (`entityClass` wins if both present)
67
+ - `entityIdentifier` (XQuery) — unique key per row
@@ -0,0 +1,26 @@
1
+ LICENCE.txt
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ requirements.txt
6
+ setup.cfg
7
+ setup.py
8
+ versioneer.py
9
+ drb/iceberg/__init__.py
10
+ drb/iceberg/_version.py
11
+ drb/iceberg/core.py
12
+ drb/iceberg/mapping.py
13
+ drb/iceberg/parser.py
14
+ drb_iceberg.egg-info/PKG-INFO
15
+ drb_iceberg.egg-info/SOURCES.txt
16
+ drb_iceberg.egg-info/dependency_links.txt
17
+ drb_iceberg.egg-info/entry_points.txt
18
+ drb_iceberg.egg-info/not-zip-safe
19
+ drb_iceberg.egg-info/requires.txt
20
+ drb_iceberg.egg-info/top_level.txt
21
+ tests/test_iceberg_addon.py
22
+ tests/test_iceberg_addon_apply.py
23
+ tests/test_mapping.py
24
+ tests/test_parser_build.py
25
+ tests/test_parser_main.py
26
+ tests/test_parser_partitions.py
@@ -0,0 +1,2 @@
1
+ [drb.addon]
2
+ iceberg = drb.iceberg.core:IcebergAddon
@@ -0,0 +1,3 @@
1
+ drb<3,>=2.2
2
+ drb-metadata<2,>=1.4
3
+ drb-extractor~=1.3.0
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools", "versioneer[toml]"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,3 @@
1
+ drb>=2.2,<3
2
+ drb-metadata>=1.4,<2
3
+ drb-extractor~=1.3.0