artifact-parser 1.0.0__tar.gz → 1.1.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.
Files changed (90) hide show
  1. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/PKG-INFO +67 -5
  2. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/README.md +62 -3
  3. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/pyproject.toml +6 -1
  4. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/__init__.py +10 -1
  5. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/core/__init__.py +2 -0
  6. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/core/exceptions.py +4 -0
  7. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/catalog/catalog_v1.py +1 -2
  8. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v1.py +1 -2
  9. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v10.py +1 -2
  10. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v11.py +1 -2
  11. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v12.py +1 -2
  12. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v2.py +1 -2
  13. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v3.py +1 -2
  14. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v4.py +1 -2
  15. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v5.py +1 -2
  16. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v6.py +1 -2
  17. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v7.py +1 -2
  18. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v8.py +1 -2
  19. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/manifest_v9.py +1 -2
  20. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v1.py +1 -2
  21. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v2.py +1 -2
  22. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v3.py +1 -2
  23. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v4.py +1 -2
  24. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v5.py +1 -2
  25. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/run_results_v6.py +1 -2
  26. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/sources/sources_v1.py +1 -2
  27. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/sources/sources_v2.py +1 -2
  28. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/sources/sources_v3.py +1 -2
  29. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/__init__.py +28 -0
  30. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/base.py +51 -0
  31. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/generated/__init__.py +5 -0
  32. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/generated/models/info_schema_v1.py +951 -0
  33. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/loader.py +47 -0
  34. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/plugin.py +30 -0
  35. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/resources/info_schema_v1.json +2937 -0
  36. artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/utils.py +38 -0
  37. artifact_parser-1.1.0/src/artifact_parser/py.typed +0 -0
  38. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/cli.py +24 -0
  39. artifact_parser-1.1.0/src/codegen/dbt_info_schema/__init__.py +1 -0
  40. artifact_parser-1.1.0/src/codegen/dbt_info_schema/generator.py +193 -0
  41. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/.gitignore +0 -0
  42. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/LICENSE +0 -0
  43. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/core/base.py +0 -0
  44. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/core/parser.py +0 -0
  45. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/core/registry.py +0 -0
  46. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/__init__.py +0 -0
  47. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/__init__.py +0 -0
  48. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/__init__.py +0 -0
  49. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/catalog/__init__.py +0 -0
  50. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/manifest/__init__.py +0 -0
  51. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/run_results/__init__.py +0 -0
  52. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/models/sources/__init__.py +0 -0
  53. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/parser.py +0 -0
  54. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/generated/version_map.py +0 -0
  55. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/plugin.py +0 -0
  56. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/catalog/catalog_v1.json +0 -0
  57. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v1.json +0 -0
  58. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v10.json +0 -0
  59. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v11.json +0 -0
  60. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v12.json +0 -0
  61. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v2.json +0 -0
  62. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v3.json +0 -0
  63. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v4.json +0 -0
  64. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v5.json +0 -0
  65. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v6.json +0 -0
  66. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v7.json +0 -0
  67. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v8.json +0 -0
  68. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/manifest/manifest_v9.json +0 -0
  69. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v1.json +0 -0
  70. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v2.json +0 -0
  71. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v3.json +0 -0
  72. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v4.json +0 -0
  73. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v5.json +0 -0
  74. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/run-results/run-results_v6.json +0 -0
  75. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/sources/sources_v1.json +0 -0
  76. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/sources/sources_v2.json +0 -0
  77. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/resources/sources/sources_v3.json +0 -0
  78. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/artifact_parser/dbt/utils.py +0 -0
  79. /artifact_parser-1.0.0/src/artifact_parser/py.typed → /artifact_parser-1.1.0/src/artifact_parser/dbt_info_schema/generated/models/__init__.py +0 -0
  80. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/__init__.py +0 -0
  81. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/__main__.py +0 -0
  82. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/__init__.py +0 -0
  83. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/artifact_spec.py +0 -0
  84. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/generator.py +0 -0
  85. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/paths.py +0 -0
  86. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/templates/generated_init.py.jinja +0 -0
  87. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/templates/parser.py.jinja +0 -0
  88. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/templates/version_map.py.jinja +0 -0
  89. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/templates/versions.py.jinja +0 -0
  90. {artifact_parser-1.0.0 → artifact_parser-1.1.0}/src/codegen/dbt/versions.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: artifact-parser
3
- Version: 1.0.0
3
+ Version: 1.1.0
4
4
  Summary: A pluggable framework for parsing data tool artifacts into typed Python models — dbt-core first.
5
5
  Project-URL: Homepage, https://github.com/datnguye/artifact-parser
6
6
  Project-URL: Repository, https://github.com/datnguye/artifact-parser
@@ -20,11 +20,30 @@ Requires-Dist: pydantic>=2.0
20
20
  Provides-Extra: codegen
21
21
  Requires-Dist: datamodel-code-generator>=0.63.0; extra == 'codegen'
22
22
  Requires-Dist: jinja2>=3.1; extra == 'codegen'
23
+ Requires-Dist: pyarrow>=15; extra == 'codegen'
23
24
  Requires-Dist: typer>=0.26.7; extra == 'codegen'
24
25
  Provides-Extra: dbt
26
+ Provides-Extra: info-schema
27
+ Requires-Dist: pyarrow>=15; extra == 'info-schema'
25
28
  Description-Content-Type: text/markdown
26
29
 
27
- # artifact-parser
30
+ <div style="display: flex; align-items: center; justify-content: space-between;">
31
+ <div>
32
+ <h1 style="margin: 0;">artifact-parser</h1>
33
+ <p style="margin: 0;">Turn data-tool JSON artifacts into typed, validated Python objects</p>
34
+ </div>
35
+ <img src="docs/assets/logo.svg" alt="artifact-parser logo" width="270" height="60">
36
+ </div>
37
+
38
+ [![PyPI version](https://badge.fury.io/py/artifact-parser.svg)](https://pypi.org/project/artifact-parser/)
39
+ ![python-lib](https://img.shields.io/badge/Library-Python-FFCE3E?labelColor=14354C&logo=python&logoColor=white)
40
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
41
+ [![python](https://img.shields.io/badge/Python-3.10|3.11|3.12|3.13-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
42
+ [![CI](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml)
43
+ [![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg?style=flat&logo=pytest&logoColor=white)](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml)
44
+
45
+ [![artifact-parser stars](https://img.shields.io/github/stars/datnguye/artifact-parser.svg?logo=github&style=for-the-badge&label=Star%20this%20repo)](https://github.com/datnguye/artifact-parser)
46
+ [![buy me a coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?logo=buy-me-a-coffee&logoColor=white&labelColor=ff813f&style=for-the-badge)](https://www.buymeacoffee.com/datnguye)
28
47
 
29
48
  A small, pluggable framework for turning the JSON artifacts that data tools spit
30
49
  out into typed, validated Python objects. Point it at a blob, get back a pydantic
@@ -50,7 +69,7 @@ import json
50
69
  from artifact_parser import parse
51
70
 
52
71
  artifact = json.loads(open("target/manifest.json").read())
53
- model = parse(artifact) # -> a ManifestV12 (or whatever version it is)
72
+ model = parse(artifact) # -> a ManifestV12 (or whatever version it is)
54
73
  print(model.metadata.dbt_schema_version)
55
74
  ```
56
75
 
@@ -73,7 +92,7 @@ from artifact_parser import parse, UnknownArtifactError
73
92
  try:
74
93
  parse({"metadata": {"dbt_schema_version": "made-up/v99.json"}})
75
94
  except UnknownArtifactError as exc:
76
- print(exc) # No registered parser recognises this artifact. Tried: dbt.
95
+ print(exc) # No registered parser recognises this artifact. Tried: dbt.
77
96
  ```
78
97
 
79
98
  ## Supported dbt artifacts
@@ -85,6 +104,40 @@ except UnknownArtifactError as exc:
85
104
  | `run-results` | v1–v6 | `parse_run_results` | `parse_run_results_v1` … `_v6` |
86
105
  | `sources` | v1–v3 | `parse_sources` | `parse_sources_v1` … `_v3` |
87
106
 
107
+ ## dbt 2.0 parquet info schema
108
+
109
+ dbt 2.0 can write a queryable "information schema" (`dbt ... --generate-info-schema`)
110
+ to `target/info_schema/v1/<schema>.<table>.parquet`. It is its own plugin family,
111
+ `artifact_parser.dbt_info_schema`, and the loader needs the optional `pyarrow`
112
+ extra (everything else works without it):
113
+
114
+ ```bash
115
+ pip install "artifact-parser[info-schema]"
116
+ ```
117
+
118
+ ```python
119
+ from artifact_parser.dbt_info_schema import load_info_schema, parse_info_schema
120
+
121
+ tables = load_info_schema("target/info_schema/v1") # {"dbt.models": [row, ...], ...}
122
+ info = parse_info_schema("target/info_schema/v1") # InfoSchemaV1
123
+
124
+ for model in info.dbt_models:
125
+ print(model.unique_id, model.config) # JSON columns arrive as dicts/lists
126
+ ```
127
+
128
+ Only the public `dbt.*` and `dbt_rt.*` tables are read; `dbt_internal.*` is
129
+ skipped because dbt says it is not part of the contract. `InfoSchemaV1` has one
130
+ list field per table, named after it with the dot as an underscore
131
+ (`dbt.models` -> `dbt_models`, `dbt_rt.run_results` -> `dbt_rt_run_results`); an
132
+ absent table is an empty list. Unknown columns are ignored and missing ones are
133
+ `None`, so a newer dbt does not break you. The registry dispatches on a
134
+ `dbt.project` table whose `schema_version` is known, so `parse(tables)` works too.
135
+ Unknown versions raise `UnknownArtifactError`.
136
+
137
+ There is no JSON Schema upstream, so the models are generated from a committed
138
+ snapshot of the parquet columns: `codegen dbt-info-schema` regenerates them, and
139
+ `--snapshot-from <info_schema/v1 dir>` re-derives the snapshot from a real run.
140
+
88
141
  ## Architecture
89
142
 
90
143
  ```
@@ -169,3 +222,12 @@ This repo is wired for [Claude Code](https://claude.com/claude-code): a project
169
222
  [context7](https://github.com/upstash/context7) MCP for pulling fresh library
170
223
  docs. See `CLAUDE.md` for the full tour. It will not write your code for you, but
171
224
  it tries hard to keep you from shipping a failing coverage gate.
225
+
226
+ ## Support
227
+
228
+ If this saved you from hand-spelunking a `manifest.json`, consider fuelling the
229
+ next release:
230
+
231
+ - ☕ [Buy me a coffee](https://www.buymeacoffee.com/datnguye)
232
+
233
+ [![buy me a coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?logo=buy-me-a-coffee&logoColor=white&labelColor=ff813f&style=for-the-badge)](https://www.buymeacoffee.com/datnguye)
@@ -1,4 +1,20 @@
1
- # artifact-parser
1
+ <div style="display: flex; align-items: center; justify-content: space-between;">
2
+ <div>
3
+ <h1 style="margin: 0;">artifact-parser</h1>
4
+ <p style="margin: 0;">Turn data-tool JSON artifacts into typed, validated Python objects</p>
5
+ </div>
6
+ <img src="docs/assets/logo.svg" alt="artifact-parser logo" width="270" height="60">
7
+ </div>
8
+
9
+ [![PyPI version](https://badge.fury.io/py/artifact-parser.svg)](https://pypi.org/project/artifact-parser/)
10
+ ![python-lib](https://img.shields.io/badge/Library-Python-FFCE3E?labelColor=14354C&logo=python&logoColor=white)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
12
+ [![python](https://img.shields.io/badge/Python-3.10|3.11|3.12|3.13-3776AB.svg?style=flat&logo=python&logoColor=white)](https://www.python.org)
13
+ [![CI](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml)
14
+ [![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg?style=flat&logo=pytest&logoColor=white)](https://github.com/datnguye/artifact-parser/actions/workflows/ci.yml)
15
+
16
+ [![artifact-parser stars](https://img.shields.io/github/stars/datnguye/artifact-parser.svg?logo=github&style=for-the-badge&label=Star%20this%20repo)](https://github.com/datnguye/artifact-parser)
17
+ [![buy me a coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?logo=buy-me-a-coffee&logoColor=white&labelColor=ff813f&style=for-the-badge)](https://www.buymeacoffee.com/datnguye)
2
18
 
3
19
  A small, pluggable framework for turning the JSON artifacts that data tools spit
4
20
  out into typed, validated Python objects. Point it at a blob, get back a pydantic
@@ -24,7 +40,7 @@ import json
24
40
  from artifact_parser import parse
25
41
 
26
42
  artifact = json.loads(open("target/manifest.json").read())
27
- model = parse(artifact) # -> a ManifestV12 (or whatever version it is)
43
+ model = parse(artifact) # -> a ManifestV12 (or whatever version it is)
28
44
  print(model.metadata.dbt_schema_version)
29
45
  ```
30
46
 
@@ -47,7 +63,7 @@ from artifact_parser import parse, UnknownArtifactError
47
63
  try:
48
64
  parse({"metadata": {"dbt_schema_version": "made-up/v99.json"}})
49
65
  except UnknownArtifactError as exc:
50
- print(exc) # No registered parser recognises this artifact. Tried: dbt.
66
+ print(exc) # No registered parser recognises this artifact. Tried: dbt.
51
67
  ```
52
68
 
53
69
  ## Supported dbt artifacts
@@ -59,6 +75,40 @@ except UnknownArtifactError as exc:
59
75
  | `run-results` | v1–v6 | `parse_run_results` | `parse_run_results_v1` … `_v6` |
60
76
  | `sources` | v1–v3 | `parse_sources` | `parse_sources_v1` … `_v3` |
61
77
 
78
+ ## dbt 2.0 parquet info schema
79
+
80
+ dbt 2.0 can write a queryable "information schema" (`dbt ... --generate-info-schema`)
81
+ to `target/info_schema/v1/<schema>.<table>.parquet`. It is its own plugin family,
82
+ `artifact_parser.dbt_info_schema`, and the loader needs the optional `pyarrow`
83
+ extra (everything else works without it):
84
+
85
+ ```bash
86
+ pip install "artifact-parser[info-schema]"
87
+ ```
88
+
89
+ ```python
90
+ from artifact_parser.dbt_info_schema import load_info_schema, parse_info_schema
91
+
92
+ tables = load_info_schema("target/info_schema/v1") # {"dbt.models": [row, ...], ...}
93
+ info = parse_info_schema("target/info_schema/v1") # InfoSchemaV1
94
+
95
+ for model in info.dbt_models:
96
+ print(model.unique_id, model.config) # JSON columns arrive as dicts/lists
97
+ ```
98
+
99
+ Only the public `dbt.*` and `dbt_rt.*` tables are read; `dbt_internal.*` is
100
+ skipped because dbt says it is not part of the contract. `InfoSchemaV1` has one
101
+ list field per table, named after it with the dot as an underscore
102
+ (`dbt.models` -> `dbt_models`, `dbt_rt.run_results` -> `dbt_rt_run_results`); an
103
+ absent table is an empty list. Unknown columns are ignored and missing ones are
104
+ `None`, so a newer dbt does not break you. The registry dispatches on a
105
+ `dbt.project` table whose `schema_version` is known, so `parse(tables)` works too.
106
+ Unknown versions raise `UnknownArtifactError`.
107
+
108
+ There is no JSON Schema upstream, so the models are generated from a committed
109
+ snapshot of the parquet columns: `codegen dbt-info-schema` regenerates them, and
110
+ `--snapshot-from <info_schema/v1 dir>` re-derives the snapshot from a real run.
111
+
62
112
  ## Architecture
63
113
 
64
114
  ```
@@ -143,3 +193,12 @@ This repo is wired for [Claude Code](https://claude.com/claude-code): a project
143
193
  [context7](https://github.com/upstash/context7) MCP for pulling fresh library
144
194
  docs. See `CLAUDE.md` for the full tour. It will not write your code for you, but
145
195
  it tries hard to keep you from shipping a failing coverage gate.
196
+
197
+ ## Support
198
+
199
+ If this saved you from hand-spelunking a `manifest.json`, consider fuelling the
200
+ next release:
201
+
202
+ - ☕ [Buy me a coffee](https://www.buymeacoffee.com/datnguye)
203
+
204
+ [![buy me a coffee](https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?logo=buy-me-a-coffee&logoColor=white&labelColor=ff813f&style=for-the-badge)](https://www.buymeacoffee.com/datnguye)
@@ -22,10 +22,12 @@ dependencies = [
22
22
 
23
23
  [project.optional-dependencies]
24
24
  dbt = []
25
+ info-schema = ["pyarrow>=15"]
25
26
  codegen = [
26
27
  "datamodel-code-generator>=0.63.0",
27
28
  "jinja2>=3.1",
28
29
  "typer>=0.26.7",
30
+ "pyarrow>=15",
29
31
  ]
30
32
 
31
33
  [project.scripts]
@@ -47,6 +49,7 @@ packages = ["src/artifact_parser", "src/codegen"]
47
49
  artifacts = [
48
50
  "src/artifact_parser/py.typed",
49
51
  "src/artifact_parser/dbt/resources/**/*.json",
52
+ "src/artifact_parser/dbt_info_schema/resources/*.json",
50
53
  "src/codegen/dbt/templates/*.jinja",
51
54
  ]
52
55
 
@@ -60,7 +63,7 @@ include = [
60
63
 
61
64
  [dependency-groups]
62
65
  dev = [
63
- "artifact-parser[codegen,dbt]",
66
+ "artifact-parser[codegen,dbt,info-schema]",
64
67
  "pre-commit>=4.6.0",
65
68
  "pytest>=8.0",
66
69
  "pytest-cov>=5.0",
@@ -79,6 +82,7 @@ force-single-line = true
79
82
  known-first-party = ["artifact_parser", "codegen"]
80
83
 
81
84
  [tool.ruff.lint.per-file-ignores]
85
+ "src/artifact_parser/dbt_info_schema/generated/**/*.py" = ["E501", "I", "UP", "B", "SIM"]
82
86
  "src/artifact_parser/dbt/generated/**/*.py" = ["E501", "I", "UP", "B", "SIM"]
83
87
  "src/codegen/cli.py" = ["B008"]
84
88
 
@@ -92,6 +96,7 @@ branch = true
92
96
  omit = [
93
97
  "src/artifact_parser/dbt/generated/*.py",
94
98
  "src/artifact_parser/dbt/generated/models/*/*.py",
99
+ "src/artifact_parser/dbt_info_schema/generated/models/*.py",
95
100
  "src/codegen/__main__.py",
96
101
  ]
97
102
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  The framework is source-agnostic: each plugin owns one family of artifacts and
4
4
  registers itself with the shared :data:`~artifact_parser.core.registry.registry`.
5
- The first (and currently only) plugin parses dbt-core artifacts.
5
+ Plugins parse dbt-core artifacts and dbt 2.0's parquet info schema.
6
6
 
7
7
  The headline entry point is :func:`parse`, which sniffs any supported artifact
8
8
  and routes it to the right plugin::
@@ -39,6 +39,15 @@ except ImportError: # pragma: no cover - only when dbt/generated/ is dropped
39
39
  stacklevel=2,
40
40
  )
41
41
 
42
+ try:
43
+ importlib.import_module("artifact_parser.dbt_info_schema") # registers parquet
44
+ except ImportError: # pragma: no cover - only when its generated/ is dropped
45
+ warnings.warn(
46
+ "artifact_parser.dbt_info_schema is unavailable (generated code missing). "
47
+ "Run `codegen dbt-info-schema` to rebuild it.",
48
+ stacklevel=2,
49
+ )
50
+
42
51
  parse = registry.parse
43
52
 
44
53
  __all__ = [
@@ -2,6 +2,7 @@
2
2
 
3
3
  from artifact_parser.core.base import BaseArtifactModel
4
4
  from artifact_parser.core.exceptions import ArtifactParserError
5
+ from artifact_parser.core.exceptions import OptionalDependencyError
5
6
  from artifact_parser.core.exceptions import ParserRegistrationError
6
7
  from artifact_parser.core.exceptions import UnknownArtifactError
7
8
  from artifact_parser.core.parser import ArtifactParser
@@ -12,6 +13,7 @@ __all__ = [
12
13
  "ArtifactParser",
13
14
  "ArtifactParserError",
14
15
  "BaseArtifactModel",
16
+ "OptionalDependencyError",
15
17
  "ParserRegistrationError",
16
18
  "ParserRegistry",
17
19
  "UnknownArtifactError",
@@ -11,3 +11,7 @@ class UnknownArtifactError(ArtifactParserError):
11
11
 
12
12
  class ParserRegistrationError(ArtifactParserError):
13
13
  """Raised when a parser is registered under a name that is already taken."""
14
+
15
+
16
+ class OptionalDependencyError(ArtifactParserError):
17
+ """Raised when a feature needs an optional extra that is not installed."""
@@ -5,9 +5,8 @@ from __future__ import annotations
5
5
 
6
6
  from typing import Any
7
7
 
8
- from pydantic import ConfigDict, Field
9
-
10
8
  from artifact_parser.core.base import BaseArtifactModel
9
+ from pydantic import ConfigDict, Field
11
10
 
12
11
 
13
12
  class Metadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, RootModel, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, RootModel, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -7,9 +7,8 @@ from enum import Enum
7
7
  from typing import Any, Literal
8
8
  from uuid import UUID
9
9
 
10
- from pydantic import ConfigDict, Field, constr
11
-
12
10
  from artifact_parser.core.base import BaseArtifactModel
11
+ from pydantic import ConfigDict, Field, constr
13
12
 
14
13
 
15
14
  class Metadata(BaseArtifactModel):
@@ -7,9 +7,8 @@ from enum import Enum
7
7
  from typing import Any, Literal
8
8
  from uuid import UUID
9
9
 
10
- from pydantic import ConfigDict, Field, constr
11
-
12
10
  from artifact_parser.core.base import BaseArtifactModel
11
+ from pydantic import ConfigDict, Field, constr
13
12
 
14
13
 
15
14
  class Quoting(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field, constr
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field, constr
12
11
 
13
12
 
14
13
  class ManifestMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict
12
11
 
13
12
 
14
13
  class BaseArtifactMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict
12
11
 
13
12
 
14
13
  class BaseArtifactMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict
12
11
 
13
12
 
14
13
  class BaseArtifactMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict, Field
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict, Field
12
11
 
13
12
 
14
13
  class BaseArtifactMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import ConfigDict, Field
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import ConfigDict, Field
12
11
 
13
12
 
14
13
  class Metadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import ConfigDict, Field
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import ConfigDict, Field
12
11
 
13
12
 
14
13
  class Metadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict
12
11
 
13
12
 
14
13
  class FreshnessMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import AwareDatetime, ConfigDict
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import AwareDatetime, ConfigDict
12
11
 
13
12
 
14
13
  class FreshnessMetadata(BaseArtifactModel):
@@ -6,9 +6,8 @@ from __future__ import annotations
6
6
  from enum import Enum
7
7
  from typing import Any
8
8
 
9
- from pydantic import ConfigDict, Field
10
-
11
9
  from artifact_parser.core.base import BaseArtifactModel
10
+ from pydantic import ConfigDict, Field
12
11
 
13
12
 
14
13
  class Metadata(BaseArtifactModel):
@@ -0,0 +1,28 @@
1
+ """dbt 2.0 parquet "information schema" parser.
2
+
3
+ dbt writes ``target/info_schema/v1/<schema>.<table>.parquet`` when run with
4
+ ``--generate-info-schema``. :func:`load_info_schema` reads the public tables
5
+ (``dbt.*`` and ``dbt_rt.*``) into ``{"dbt.models": [row, ...], ...}`` and
6
+ :func:`parse_info_schema` types them as :class:`InfoSchemaV1`. The loader needs
7
+ the optional ``info-schema`` extra (``pyarrow``); the rest does not.
8
+
9
+ Importing this package registers :class:`DbtInfoSchemaParser` with the shared
10
+ registry, so ``registry.parse(tables)`` dispatches on ``dbt.project``.
11
+ """
12
+
13
+ from artifact_parser.core.registry import registry
14
+ from artifact_parser.dbt_info_schema.generated.models.info_schema_v1 import InfoSchemaV1
15
+ from artifact_parser.dbt_info_schema.loader import load_info_schema
16
+ from artifact_parser.dbt_info_schema.loader import parse_info_schema
17
+ from artifact_parser.dbt_info_schema.plugin import DbtInfoSchemaParser
18
+
19
+ dbt_info_schema_parser = DbtInfoSchemaParser()
20
+ registry.register(dbt_info_schema_parser)
21
+
22
+ __all__ = [
23
+ "DbtInfoSchemaParser",
24
+ "InfoSchemaV1",
25
+ "dbt_info_schema_parser",
26
+ "load_info_schema",
27
+ "parse_info_schema",
28
+ ]
@@ -0,0 +1,51 @@
1
+ """Base class for every generated info-schema row model and the container."""
2
+
3
+ import json
4
+ from typing import Any
5
+
6
+ from pydantic import ConfigDict
7
+ from pydantic import model_validator
8
+
9
+ from artifact_parser.core.base import BaseArtifactModel
10
+
11
+ JSON_EXTRA_KEY = "x-json"
12
+
13
+
14
+ def decode_json_column(value: Any) -> Any:
15
+ """Decode a JSON-encoded VARCHAR value, tolerating double encoding.
16
+
17
+ dbt sometimes JSON-encodes an already JSON-encoded object (``"\\"{...}\\""``),
18
+ so decoding repeats while the result is still a JSON string. Values that are
19
+ not valid JSON are returned untouched rather than rejected.
20
+ """
21
+ while isinstance(value, str):
22
+ try:
23
+ value = json.loads(value)
24
+ except json.JSONDecodeError:
25
+ return value
26
+ return value
27
+
28
+
29
+ class InfoSchemaModel(BaseArtifactModel):
30
+ """Root of the info-schema models.
31
+
32
+ Unknown columns are ignored (forward drift). Fields flagged ``x-json`` in the
33
+ committed schema snapshot hold JSON text in the parquet file and are decoded
34
+ into dicts/lists on validation.
35
+ """
36
+
37
+ model_config = ConfigDict(extra="ignore", populate_by_name=True)
38
+
39
+ @model_validator(mode="before")
40
+ @classmethod
41
+ def _decode_json_columns(cls, data: Any) -> Any:
42
+ if not isinstance(data, dict):
43
+ return data
44
+ decoded = dict(data)
45
+ for name, field in cls.model_fields.items():
46
+ extra = field.json_schema_extra
47
+ if isinstance(extra, dict) and extra.get(JSON_EXTRA_KEY):
48
+ key = field.alias or name
49
+ if key in decoded:
50
+ decoded[key] = decode_json_column(decoded[key])
51
+ return decoded
@@ -0,0 +1,5 @@
1
+ """Generated info-schema models — DO NOT EDIT BY HAND.
2
+
3
+ Produced by ``codegen dbt-info-schema`` from the committed schema snapshot in
4
+ ``resources/info_schema_v1.json``. Safe to delete and rebuild.
5
+ """