dataenginex.data
Data layer — connectors, transforms, quality gates, pipelines.
Public API::
from dataenginex.data import (
# New registry-based API
connector_registry, transform_registry,
DuckDBConnector, CsvConnector,
PipelineRunner, PipelineResult,
QualityResult, check_quality,
# Legacy API
DataConnector, RestConnector, FileConnector,
ConnectorStatus, FetchResult,
DataProfiler, ProfileReport, ColumnProfile,
SchemaRegistry, SchemaVersion,
)
CsvConnector
Bases: BaseConnector
CSV connector backed by DuckDB CSV reader.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Directory containing CSV files. |
'.'
|
default_file
|
str | None
|
Default file to read (for conformance test). |
None
|
Source code in src/dataenginex/data/connectors/csv.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
DuckDBConnector
Bases: BaseConnector
DuckDB-backed connector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
database
|
str
|
Path to DuckDB file. ":memory:" for in-memory. |
':memory:'
|
Source code in src/dataenginex/data/connectors/duckdb.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
connection
property
Direct access to the DuckDB connection for advanced use.
execute(sql)
Execute raw SQL and return results as list of dicts.
Source code in src/dataenginex/data/connectors/duckdb.py
85 86 87 88 89 90 91 | |
ConnectorStatus
Bases: StrEnum
Lifecycle states for a data connector.
Source code in src/dataenginex/data/connectors/legacy.py
39 40 41 42 43 44 45 46 | |
DataConnector
Bases: ABC
Base class for all data connectors in DEX.
Subclass and implement connect, fetch, and close.
Source code in src/dataenginex/data/connectors/legacy.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
connect()
abstractmethod
async
Establish connection to the data source.
Source code in src/dataenginex/data/connectors/legacy.py
94 95 96 97 | |
fetch(*, limit=None, offset=0, filters=None)
abstractmethod
async
Retrieve records from the data source.
Source code in src/dataenginex/data/connectors/legacy.py
99 100 101 102 103 104 105 106 107 108 | |
close()
abstractmethod
async
Release resources held by the connector.
Source code in src/dataenginex/data/connectors/legacy.py
110 111 112 113 | |
FetchResult
dataclass
Outcome of a single fetch invocation.
Attributes:
| Name | Type | Description |
|---|---|---|
records |
list[dict[str, Any]]
|
Retrieved data records. |
record_count |
int
|
Number of records returned. |
source |
str
|
Name of the data source. |
fetched_at |
datetime
|
Timestamp of the fetch. |
duration_ms |
float
|
Fetch duration in milliseconds. |
errors |
list[str]
|
Error messages (empty on success). |
Source code in src/dataenginex/data/connectors/legacy.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
success
property
Return True if the fetch completed without errors.
FileConnector
Bases: DataConnector
Reads records from local JSON, JSONL, or CSV files.
Parameters
name:
Human-readable connector label.
path:
File system path to the data file.
file_format:
One of "json", "jsonl", "csv".
encoding:
Text encoding (default utf-8).
Source code in src/dataenginex/data/connectors/legacy.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
connect()
async
Verify the configured file exists and is readable.
Source code in src/dataenginex/data/connectors/legacy.py
295 296 297 298 299 300 301 | |
fetch(*, limit=None, offset=0, filters=None)
async
Read and parse records from the local file.
Source code in src/dataenginex/data/connectors/legacy.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 | |
close()
async
Release cached file data.
Source code in src/dataenginex/data/connectors/legacy.py
344 345 346 347 | |
RestConnector
Bases: DataConnector
Fetches records from an HTTP/REST API endpoint.
Parameters
name:
Human-readable connector label.
base_url:
Root URL of the API (e.g. https://api.example.com).
endpoint:
Path appended to base_url for fetches (e.g. /v1/jobs).
headers:
Extra HTTP headers (auth tokens, accept types, etc.).
timeout:
HTTP timeout in seconds (default 30).
records_key:
JSON key that contains the result list (e.g. "data").
When None the root response is expected to be a list.
Source code in src/dataenginex/data/connectors/legacy.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
connect()
async
Open an HTTP client session to the configured base URL.
Source code in src/dataenginex/data/connectors/legacy.py
178 179 180 181 182 183 184 185 186 187 188 189 190 | |
fetch(*, limit=None, offset=0, filters=None)
async
Fetch records from the REST endpoint with optional pagination.
Source code in src/dataenginex/data/connectors/legacy.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
close()
async
Close the HTTP client session and release resources.
Source code in src/dataenginex/data/connectors/legacy.py
247 248 249 250 251 252 253 | |
PipelineResult
dataclass
Result of a single pipeline execution.
Source code in src/dataenginex/data/pipeline/runner.py
40 41 42 43 44 45 46 47 48 49 50 | |
PipelineRunner
Execute data pipelines defined in dex.yaml.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
DexConfig
|
Loaded DexConfig. |
required |
data_dir
|
Path | None
|
Root directory for lakehouse layer storage. |
None
|
Source code in src/dataenginex/data/pipeline/runner.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
run(pipeline_name, *, dry_run=False)
Run a single pipeline by name.
Source code in src/dataenginex/data/pipeline/runner.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
run_all()
Run all pipelines in dependency order.
Source code in src/dataenginex/data/pipeline/runner.py
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
ColumnProfile
dataclass
Statistics for a single column / field.
Source code in src/dataenginex/data/profiler.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
null_rate
property
Fraction of values that are None (0.0–1.0).
uniqueness
property
Ratio of unique non-null values to total non-null values.
DataProfiler
Profile a list of dict records in pure Python (no pandas needed).
Source code in src/dataenginex/data/profiler.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
profile(records, dataset_name='unnamed')
Profile a list of dict records and return column-level statistics.
Source code in src/dataenginex/data/profiler.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
ProfileReport
dataclass
Aggregated profiling report for a dataset.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_name |
str
|
Name of the profiled dataset. |
record_count |
int
|
Total number of records profiled. |
column_count |
int
|
Number of columns/fields discovered. |
columns |
list[ColumnProfile]
|
Per-column profile statistics. |
profiled_at |
datetime
|
Timestamp when profiling was performed. |
duration_ms |
float
|
Time taken for profiling in milliseconds. |
Source code in src/dataenginex/data/profiler.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
completeness
property
Overall dataset completeness (1 − avg null rate).
to_dict()
Serialize the profile report to a plain dictionary.
Source code in src/dataenginex/data/profiler.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | |
QualityResult
dataclass
Result of a quality gate check.
Source code in src/dataenginex/data/quality/gates.py
36 37 38 39 40 41 42 43 44 45 | |
SchemaRegistry
In-process schema registry backed by an optional JSON file.
Parameters
persist_path: If given, schemas are saved/loaded from this JSON file so they survive across process restarts.
Source code in src/dataenginex/data/registry.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
register(schema)
Register a new schema version. Duplicate versions are rejected.
Source code in src/dataenginex/data/registry.py
89 90 91 92 93 94 95 96 97 98 | |
get_latest(name)
Return the most recently registered version for name.
Source code in src/dataenginex/data/registry.py
100 101 102 103 104 105 | |
get_version(name, version)
Return a specific version, or None if not found.
Source code in src/dataenginex/data/registry.py
107 108 109 110 111 112 | |
list_schemas()
Return all registered schema names.
Source code in src/dataenginex/data/registry.py
114 115 116 | |
list_versions(name)
Return all registered versions for name (oldest first).
Source code in src/dataenginex/data/registry.py
118 119 120 | |
validate(name, record, version=None)
Validate record against a schema.
If version is None the latest version is used.
Source code in src/dataenginex/data/registry.py
122 123 124 125 126 127 128 129 130 131 132 | |
SchemaVersion
dataclass
An immutable snapshot of a schema at a particular version.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Schema identifier (e.g. |
version |
str
|
Semver string (e.g. |
fields |
dict[str, str]
|
Mapping of field names to type descriptions. |
required_fields |
list[str]
|
Fields that must be present in every record. |
description |
str
|
Human-readable summary of the schema. |
created_at |
datetime
|
When this version was registered. |
metadata |
dict[str, Any]
|
Extra context dict. |
Source code in src/dataenginex/data/registry.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
to_dict()
Serialize the schema version to a plain dictionary.
Source code in src/dataenginex/data/registry.py
48 49 50 51 52 53 54 55 56 57 58 | |
validate_record(record)
Check that record has all required fields.
Returns (is_valid, errors) where errors lists the missing
required fields.
Source code in src/dataenginex/data/registry.py
60 61 62 63 64 65 66 67 | |
check_quality(conn, table, *, completeness=None, uniqueness=None, schema=None, custom_sql=None)
Run quality checks against a DuckDB table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
conn
|
DuckDBPyConnection
|
Active DuckDB connection. |
required |
table
|
str
|
Table name to check. |
required |
completeness
|
float | None
|
Minimum fraction of non-null values (0.0-1.0). |
None
|
uniqueness
|
list[str] | None
|
Columns that must be unique (no duplicates). |
None
|
schema
|
list[ColumnSpec] | None
|
Expected column specs (existence, type, nullability). Checked even on empty tables. |
None
|
custom_sql
|
str | None
|
SQL that must return count > 0 to pass. |
None
|
Returns:
| Type | Description |
|---|---|
QualityResult
|
QualityResult with pass/fail, scores, and any schema violations. |
Source code in src/dataenginex/data/quality/gates.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 | |