odcr 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.
Files changed (49) hide show
  1. odcr-0.2.0/LICENSE +201 -0
  2. odcr-0.2.0/PKG-INFO +249 -0
  3. odcr-0.2.0/README.md +141 -0
  4. odcr-0.2.0/pyproject.toml +104 -0
  5. odcr-0.2.0/setup.cfg +4 -0
  6. odcr-0.2.0/src/odcr/__init__.py +28 -0
  7. odcr-0.2.0/src/odcr/__main__.py +5 -0
  8. odcr-0.2.0/src/odcr/adapters/__init__.py +173 -0
  9. odcr-0.2.0/src/odcr/adapters/athena.py +53 -0
  10. odcr-0.2.0/src/odcr/adapters/base.py +487 -0
  11. odcr-0.2.0/src/odcr/adapters/bigquery.py +56 -0
  12. odcr-0.2.0/src/odcr/adapters/cosmosdb.py +224 -0
  13. odcr-0.2.0/src/odcr/adapters/databricks.py +59 -0
  14. odcr-0.2.0/src/odcr/adapters/db2.py +64 -0
  15. odcr-0.2.0/src/odcr/adapters/document.py +89 -0
  16. odcr-0.2.0/src/odcr/adapters/duckdb.py +36 -0
  17. odcr-0.2.0/src/odcr/adapters/files.py +139 -0
  18. odcr-0.2.0/src/odcr/adapters/mongodb.py +178 -0
  19. odcr-0.2.0/src/odcr/adapters/mysql.py +33 -0
  20. odcr-0.2.0/src/odcr/adapters/oracle.py +55 -0
  21. odcr-0.2.0/src/odcr/adapters/postgres.py +33 -0
  22. odcr-0.2.0/src/odcr/adapters/redshift.py +33 -0
  23. odcr-0.2.0/src/odcr/adapters/snowflake.py +35 -0
  24. odcr-0.2.0/src/odcr/adapters/sqlite.py +46 -0
  25. odcr-0.2.0/src/odcr/adapters/sqlserver.py +96 -0
  26. odcr-0.2.0/src/odcr/adapters/trino.py +38 -0
  27. odcr-0.2.0/src/odcr/checks.py +110 -0
  28. odcr-0.2.0/src/odcr/cli.py +436 -0
  29. odcr-0.2.0/src/odcr/config.py +121 -0
  30. odcr-0.2.0/src/odcr/contract.py +287 -0
  31. odcr-0.2.0/src/odcr/integrations/__init__.py +2 -0
  32. odcr-0.2.0/src/odcr/integrations/airflow.py +114 -0
  33. odcr-0.2.0/src/odcr/lint.py +45 -0
  34. odcr-0.2.0/src/odcr/meta.py +68 -0
  35. odcr-0.2.0/src/odcr/notify.py +171 -0
  36. odcr-0.2.0/src/odcr/observe.py +105 -0
  37. odcr-0.2.0/src/odcr/py.typed +0 -0
  38. odcr-0.2.0/src/odcr/reconcile.py +264 -0
  39. odcr-0.2.0/src/odcr/repository.py +124 -0
  40. odcr-0.2.0/src/odcr/runner.py +267 -0
  41. odcr-0.2.0/src/odcr/samples.py +42 -0
  42. odcr-0.2.0/src/odcr/scaffold.py +428 -0
  43. odcr-0.2.0/src/odcr/watch.py +85 -0
  44. odcr-0.2.0/src/odcr.egg-info/PKG-INFO +249 -0
  45. odcr-0.2.0/src/odcr.egg-info/SOURCES.txt +47 -0
  46. odcr-0.2.0/src/odcr.egg-info/dependency_links.txt +1 -0
  47. odcr-0.2.0/src/odcr.egg-info/entry_points.txt +2 -0
  48. odcr-0.2.0/src/odcr.egg-info/requires.txt +95 -0
  49. odcr-0.2.0/src/odcr.egg-info/top_level.txt +1 -0
odcr-0.2.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
odcr-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,249 @@
1
+ Metadata-Version: 2.4
2
+ Name: odcr
3
+ Version: 0.2.0
4
+ Summary: Open Data Contract Runtime: enforce ODCS data contracts where data lands, reconcile source and target, and trace every batch end to end, on any database, lake or cloud.
5
+ Author: sulfibashy, odcr contributors
6
+ Maintainer: sulfibashy
7
+ License-Expression: Apache-2.0
8
+ Project-URL: Homepage, https://github.com/sulfibashy/odcr
9
+ Project-URL: Documentation, https://sulfibashy.github.io/odcr/
10
+ Project-URL: Repository, https://github.com/sulfibashy/odcr
11
+ Project-URL: Issues, https://github.com/sulfibashy/odcr/issues
12
+ Project-URL: Changelog, https://github.com/sulfibashy/odcr/blob/main/CHANGELOG.md
13
+ Keywords: data contracts,ODCS,data quality,data observability,reconciliation,data engineering,databricks,snowflake,bigquery,duckdb,sql server,mongodb,adls
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Environment :: Console
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Intended Audience :: Information Technology
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Operating System :: Microsoft :: Windows
20
+ Classifier: Operating System :: MacOS
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Programming Language :: Python :: 3
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ Classifier: Programming Language :: Python :: 3.12
26
+ Classifier: Programming Language :: Python :: 3.13
27
+ Classifier: Topic :: Database
28
+ Classifier: Topic :: Software Development :: Quality Assurance
29
+ Classifier: Typing :: Typed
30
+ Requires-Python: >=3.10
31
+ Description-Content-Type: text/markdown
32
+ License-File: LICENSE
33
+ Requires-Dist: PyYAML>=6.0
34
+ Provides-Extra: duckdb
35
+ Requires-Dist: duckdb>=1.1; extra == "duckdb"
36
+ Provides-Extra: files
37
+ Requires-Dist: duckdb>=1.1; extra == "files"
38
+ Provides-Extra: postgres
39
+ Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
40
+ Provides-Extra: mysql
41
+ Requires-Dist: PyMySQL>=1.1; extra == "mysql"
42
+ Provides-Extra: sqlserver
43
+ Requires-Dist: pyodbc>=5.0; extra == "sqlserver"
44
+ Requires-Dist: python-tds>=1.15; extra == "sqlserver"
45
+ Provides-Extra: synapse
46
+ Requires-Dist: pyodbc>=5.0; extra == "synapse"
47
+ Requires-Dist: python-tds>=1.15; extra == "synapse"
48
+ Provides-Extra: fabric
49
+ Requires-Dist: pyodbc>=5.0; extra == "fabric"
50
+ Requires-Dist: python-tds>=1.15; extra == "fabric"
51
+ Provides-Extra: oracle
52
+ Requires-Dist: oracledb>=2.0; extra == "oracle"
53
+ Provides-Extra: db2
54
+ Requires-Dist: ibm_db>=3.2; extra == "db2"
55
+ Provides-Extra: trino
56
+ Requires-Dist: trino>=0.330; extra == "trino"
57
+ Provides-Extra: snowflake
58
+ Requires-Dist: snowflake-connector-python>=3.6; extra == "snowflake"
59
+ Provides-Extra: databricks
60
+ Requires-Dist: databricks-sql-connector>=3.1; extra == "databricks"
61
+ Provides-Extra: bigquery
62
+ Requires-Dist: google-cloud-bigquery>=3.17; extra == "bigquery"
63
+ Provides-Extra: redshift
64
+ Requires-Dist: redshift_connector>=2.1; extra == "redshift"
65
+ Provides-Extra: athena
66
+ Requires-Dist: PyAthena>=3.0; extra == "athena"
67
+ Provides-Extra: mongodb
68
+ Requires-Dist: pymongo>=4.6; extra == "mongodb"
69
+ Provides-Extra: cosmosdb
70
+ Requires-Dist: azure-cosmos>=4.5; extra == "cosmosdb"
71
+ Requires-Dist: azure-identity>=1.15; extra == "cosmosdb"
72
+ Provides-Extra: lint
73
+ Requires-Dist: datacontract-cli>=0.10; extra == "lint"
74
+ Provides-Extra: all
75
+ Requires-Dist: duckdb>=1.1; extra == "all"
76
+ Requires-Dist: psycopg[binary]>=3.1; extra == "all"
77
+ Requires-Dist: PyMySQL>=1.1; extra == "all"
78
+ Requires-Dist: pyodbc>=5.0; extra == "all"
79
+ Requires-Dist: python-tds>=1.15; extra == "all"
80
+ Requires-Dist: oracledb>=2.0; extra == "all"
81
+ Requires-Dist: trino>=0.330; extra == "all"
82
+ Requires-Dist: snowflake-connector-python>=3.6; extra == "all"
83
+ Requires-Dist: databricks-sql-connector>=3.1; extra == "all"
84
+ Requires-Dist: google-cloud-bigquery>=3.17; extra == "all"
85
+ Requires-Dist: redshift_connector>=2.1; extra == "all"
86
+ Requires-Dist: PyAthena>=3.0; extra == "all"
87
+ Requires-Dist: pymongo>=4.6; extra == "all"
88
+ Requires-Dist: azure-cosmos>=4.5; extra == "all"
89
+ Requires-Dist: azure-identity>=1.15; extra == "all"
90
+ Provides-Extra: dev
91
+ Requires-Dist: pytest>=8; extra == "dev"
92
+ Requires-Dist: pytest-cov>=5; extra == "dev"
93
+ Requires-Dist: ruff>=0.6; extra == "dev"
94
+ Requires-Dist: build>=1.2; extra == "dev"
95
+ Requires-Dist: twine>=5; extra == "dev"
96
+ Requires-Dist: duckdb>=1.1; extra == "dev"
97
+ Requires-Dist: psycopg[binary]>=3.1; extra == "dev"
98
+ Requires-Dist: PyMySQL>=1.1; extra == "dev"
99
+ Requires-Dist: python-tds>=1.15; extra == "dev"
100
+ Requires-Dist: oracledb>=2.0; extra == "dev"
101
+ Requires-Dist: trino>=0.330; extra == "dev"
102
+ Requires-Dist: pymongo>=4.6; extra == "dev"
103
+ Requires-Dist: mongomock>=4.1; extra == "dev"
104
+ Provides-Extra: docs
105
+ Requires-Dist: mkdocs<2,>=1.6; extra == "docs"
106
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
107
+ Dynamic: license-file
108
+
109
+ <div align="center">
110
+
111
+ # odcr — Open Data Contract Runtime
112
+
113
+ **Check every dataset against its data contract the moment it lands — on any database, lake or cloud.**
114
+
115
+ [![CI](https://github.com/sulfibashy/odcr/actions/workflows/ci.yml/badge.svg)](https://github.com/sulfibashy/odcr/actions/workflows/ci.yml)
116
+ [![PyPI](https://img.shields.io/pypi/v/odcr.svg)](https://pypi.org/project/odcr/)
117
+ [![Python](https://img.shields.io/pypi/pyversions/odcr.svg)](https://pypi.org/project/odcr/)
118
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
119
+ [![Docs](https://img.shields.io/badge/docs-sulfibashy.github.io%2Fodcr-indigo.svg)](https://sulfibashy.github.io/odcr/)
120
+ [![ODCS](https://img.shields.io/badge/contracts-ODCS%20v3-green.svg)](https://github.com/bitol-io/open-data-contract-standard)
121
+
122
+ [Documentation](https://sulfibashy.github.io/odcr/) · [Quickstart](#quickstart) · [Adapters](#adapters) · [Examples](examples/) · [Contributing](CONTRIBUTING.md)
123
+
124
+ </div>
125
+
126
+ ---
127
+
128
+ odcr reads [ODCS](https://github.com/bitol-io/open-data-contract-standard) data contracts from your **central
129
+ contract repository** and enforces them wherever data arrives — a table, a lakehouse, or files in ADLS, S3, GCS
130
+ or a landing folder — however it got there: **batch, streaming, CDC, events or file drops**.
131
+
132
+ For every batch, micro-batch or file, odcr:
133
+
134
+ | | |
135
+ | --- | --- |
136
+ | **Checks** | schema (missing columns, wrong types, drift) and quality rules (nulls, duplicates, valid values, row counts, custom SQL) |
137
+ | **Decides** | pass, warn, or fail and quarantine — the exit code stops your pipeline |
138
+ | **Notifies** | the source team and the platform team: Slack, Teams, email, Google Chat, Discord, PagerDuty, Opsgenie, webhooks |
139
+ | **Logs** | every run, check and alert in meta tables created **on the platform itself** |
140
+ | **Reconciles** | source against target per batch — even Oracle → Snowflake or ADLS files → Databricks |
141
+ | **Traces** | each batch from source to consumption, flagging the stage where rows were lost |
142
+
143
+ ## Quickstart
144
+
145
+ ```bash
146
+ pip install "odcr[postgres]" # pick your platform: odcr adapters
147
+ odcr init my_contracts --adapter postgres # creates a full project, like dbt init
148
+ cd my_contracts
149
+ cp .env.example .env # fill in the connection (Windows: copy)
150
+ odcr doctor # driver, TLS, permissions, meta tables, contracts
151
+ odcr seed # optional sample data
152
+ odcr run --contract-id orders --batch-id batch-002 --where "load_id = 'batch-002'"
153
+ ```
154
+
155
+ ```text
156
+ Contract orders v1.0.0 batch=batch-002: FAIL
157
+ orders: FAIL (4 rows, 4 failed, 0 warnings)
158
+ - [failed] orders.order_id.unique: expected = 0, got 1 (unique: no duplicate values)
159
+ - [failed] orders.customer_id.required: expected = 0, got 1 (required: no NULL values)
160
+ - [failed] orders.status.invalidValues: expected = 0, got 1
161
+ - [failed] orders.no_negative_amounts: expected = 0, got 1 (Amounts must never be negative)
162
+ ```
163
+
164
+ Then check new data automatically as it lands:
165
+
166
+ ```bash
167
+ odcr watch --contract-id orders --batch-column load_id # every new batch in a table
168
+ odcr watch --contract-id orders -C lake # every new file in ADLS / S3 / GCS
169
+ ```
170
+
171
+ ## Adapters
172
+
173
+ | | Platforms | Install |
174
+ | --- | --- | --- |
175
+ | **Files** | Parquet / CSV / JSON in local folders, network shares, **ADLS Gen2**, Azure Blob, **S3**, **GCS**, MinIO | `odcr[files]` |
176
+ | **Embedded** | DuckDB, SQLite | `odcr[duckdb]`, `odcr` |
177
+ | **On-premise / open source** | PostgreSQL, MySQL, MariaDB, **SQL Server**, **Oracle**, **IBM Db2**, Trino / Starburst / Presto | `odcr[postgres]` `[mysql]` `[sqlserver]` `[oracle]` `[db2]` `[trino]` |
178
+ | **Azure** | **Databricks**, **Synapse Analytics**, **Fabric Warehouse**, Azure SQL, **Cosmos DB**, Azure PostgreSQL / MySQL | `odcr[databricks]` `[synapse]` `[fabric]` `[sqlserver]` `[cosmosdb]` |
179
+ | **AWS** | Databricks, **Redshift**, **Athena**, Aurora / RDS, DocumentDB | `odcr[databricks]` `[redshift]` `[athena]` `[postgres]` `[mongodb]` |
180
+ | **GCP** | Databricks, **BigQuery**, Cloud SQL, AlloyDB | `odcr[databricks]` `[bigquery]` `[postgres]` |
181
+ | **Multi-cloud** | **Snowflake**, **MongoDB** / Atlas | `odcr[snowflake]` `[mongodb]` |
182
+
183
+ 18 adapters; `pip install "odcr[all]"` installs every driver. Each has a ready-to-run reference project in
184
+ [`examples/`](examples/) and a [documentation page](https://sulfibashy.github.io/odcr/adapters/).
185
+ **Informatica, Ab Initio, Azure Data Factory, SSIS, Airflow and Databricks Workflows** call odcr after they land
186
+ data — see [Integrations](https://sulfibashy.github.io/odcr/integrations/).
187
+
188
+ ## A contract
189
+
190
+ ```yaml
191
+ apiVersion: v3.0.2
192
+ kind: DataContract
193
+ id: orders
194
+ version: 1.0.0
195
+ support: # the source team is notified here
196
+ - {channel: "#orders-alerts", tool: slack, url: "${ORDERS_SLACK_WEBHOOK}"}
197
+ - {channel: orders, tool: teams, url: "${ORDERS_TEAMS_WEBHOOK}"}
198
+ - {channel: orders-team@example.com, tool: email, url: "mailto:orders-team@example.com"}
199
+ schema:
200
+ - name: orders
201
+ physicalName: sales.orders # or abfss://landing@lake.dfs.core.windows.net/orders/*.parquet
202
+ properties:
203
+ - {name: order_id, logicalType: integer, primaryKey: true}
204
+ - name: status
205
+ logicalType: string
206
+ quality:
207
+ - {type: library, metric: invalidValues, arguments: {validValues: [NEW, PAID, SHIPPED]}, mustBe: 0}
208
+ - name: amount
209
+ logicalType: number
210
+ quality:
211
+ - {type: library, metric: nullValues, mustBeLessOrEqualTo: 1, unit: percent, severity: warning}
212
+ quality:
213
+ - {type: library, metric: rowCount, mustBeGreaterThan: 0}
214
+ - {type: sql, query: "SELECT COUNT(*) FROM {object} WHERE amount < 0", mustBe: 0}
215
+ ```
216
+
217
+ ## Runs everywhere
218
+
219
+ - **Operating systems:** Windows, macOS, Linux and Unix servers — tested in CI on all three major ones.
220
+ - **Install:** `pip`, `pipx`, offline wheelhouses for air-gapped servers, the [Dockerfile](Dockerfile), Databricks
221
+ libraries, Azure Functions, AWS Lambda.
222
+ - **Security:** TLS with verified certificates by default; corporate CA bundles and proxies; secrets from
223
+ environment variables, `.env` or secret files; managed identities, IAM roles, key-pair and OAuth. See
224
+ [Security](https://sulfibashy.github.io/odcr/security/).
225
+
226
+ ## Python API
227
+
228
+ ```python
229
+ from odcr import ContractRepository, run_contract
230
+ from odcr.adapters import get_adapter
231
+ from odcr.config import load_config
232
+
233
+ config = load_config("odcr.yaml")
234
+ contract = ContractRepository.from_config(config).get("orders")
235
+ with get_adapter(config.connection("main")) as db:
236
+ result = run_contract(contract, db, config, batch_id="42", where="load_id = '42'")
237
+ if not result.passed:
238
+ raise SystemExit(result.summary())
239
+ ```
240
+
241
+ Airflow: `from odcr.integrations.airflow import OdcrContractOperator`.
242
+
243
+ ## Contributing
244
+
245
+ odcr is community-built. Adapters are the easiest way in: [adding one](docs/contributing/adding-an-adapter.md)
246
+ is ~50 lines, and the whole end-to-end suite then runs against your platform. Start with
247
+ [CONTRIBUTING.md](CONTRIBUTING.md) and issues labelled `good first issue`.
248
+
249
+ Licensed under the [Apache License 2.0](LICENSE).
odcr-0.2.0/README.md ADDED
@@ -0,0 +1,141 @@
1
+ <div align="center">
2
+
3
+ # odcr — Open Data Contract Runtime
4
+
5
+ **Check every dataset against its data contract the moment it lands — on any database, lake or cloud.**
6
+
7
+ [![CI](https://github.com/sulfibashy/odcr/actions/workflows/ci.yml/badge.svg)](https://github.com/sulfibashy/odcr/actions/workflows/ci.yml)
8
+ [![PyPI](https://img.shields.io/pypi/v/odcr.svg)](https://pypi.org/project/odcr/)
9
+ [![Python](https://img.shields.io/pypi/pyversions/odcr.svg)](https://pypi.org/project/odcr/)
10
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
11
+ [![Docs](https://img.shields.io/badge/docs-sulfibashy.github.io%2Fodcr-indigo.svg)](https://sulfibashy.github.io/odcr/)
12
+ [![ODCS](https://img.shields.io/badge/contracts-ODCS%20v3-green.svg)](https://github.com/bitol-io/open-data-contract-standard)
13
+
14
+ [Documentation](https://sulfibashy.github.io/odcr/) · [Quickstart](#quickstart) · [Adapters](#adapters) · [Examples](examples/) · [Contributing](CONTRIBUTING.md)
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ odcr reads [ODCS](https://github.com/bitol-io/open-data-contract-standard) data contracts from your **central
21
+ contract repository** and enforces them wherever data arrives — a table, a lakehouse, or files in ADLS, S3, GCS
22
+ or a landing folder — however it got there: **batch, streaming, CDC, events or file drops**.
23
+
24
+ For every batch, micro-batch or file, odcr:
25
+
26
+ | | |
27
+ | --- | --- |
28
+ | **Checks** | schema (missing columns, wrong types, drift) and quality rules (nulls, duplicates, valid values, row counts, custom SQL) |
29
+ | **Decides** | pass, warn, or fail and quarantine — the exit code stops your pipeline |
30
+ | **Notifies** | the source team and the platform team: Slack, Teams, email, Google Chat, Discord, PagerDuty, Opsgenie, webhooks |
31
+ | **Logs** | every run, check and alert in meta tables created **on the platform itself** |
32
+ | **Reconciles** | source against target per batch — even Oracle → Snowflake or ADLS files → Databricks |
33
+ | **Traces** | each batch from source to consumption, flagging the stage where rows were lost |
34
+
35
+ ## Quickstart
36
+
37
+ ```bash
38
+ pip install "odcr[postgres]" # pick your platform: odcr adapters
39
+ odcr init my_contracts --adapter postgres # creates a full project, like dbt init
40
+ cd my_contracts
41
+ cp .env.example .env # fill in the connection (Windows: copy)
42
+ odcr doctor # driver, TLS, permissions, meta tables, contracts
43
+ odcr seed # optional sample data
44
+ odcr run --contract-id orders --batch-id batch-002 --where "load_id = 'batch-002'"
45
+ ```
46
+
47
+ ```text
48
+ Contract orders v1.0.0 batch=batch-002: FAIL
49
+ orders: FAIL (4 rows, 4 failed, 0 warnings)
50
+ - [failed] orders.order_id.unique: expected = 0, got 1 (unique: no duplicate values)
51
+ - [failed] orders.customer_id.required: expected = 0, got 1 (required: no NULL values)
52
+ - [failed] orders.status.invalidValues: expected = 0, got 1
53
+ - [failed] orders.no_negative_amounts: expected = 0, got 1 (Amounts must never be negative)
54
+ ```
55
+
56
+ Then check new data automatically as it lands:
57
+
58
+ ```bash
59
+ odcr watch --contract-id orders --batch-column load_id # every new batch in a table
60
+ odcr watch --contract-id orders -C lake # every new file in ADLS / S3 / GCS
61
+ ```
62
+
63
+ ## Adapters
64
+
65
+ | | Platforms | Install |
66
+ | --- | --- | --- |
67
+ | **Files** | Parquet / CSV / JSON in local folders, network shares, **ADLS Gen2**, Azure Blob, **S3**, **GCS**, MinIO | `odcr[files]` |
68
+ | **Embedded** | DuckDB, SQLite | `odcr[duckdb]`, `odcr` |
69
+ | **On-premise / open source** | PostgreSQL, MySQL, MariaDB, **SQL Server**, **Oracle**, **IBM Db2**, Trino / Starburst / Presto | `odcr[postgres]` `[mysql]` `[sqlserver]` `[oracle]` `[db2]` `[trino]` |
70
+ | **Azure** | **Databricks**, **Synapse Analytics**, **Fabric Warehouse**, Azure SQL, **Cosmos DB**, Azure PostgreSQL / MySQL | `odcr[databricks]` `[synapse]` `[fabric]` `[sqlserver]` `[cosmosdb]` |
71
+ | **AWS** | Databricks, **Redshift**, **Athena**, Aurora / RDS, DocumentDB | `odcr[databricks]` `[redshift]` `[athena]` `[postgres]` `[mongodb]` |
72
+ | **GCP** | Databricks, **BigQuery**, Cloud SQL, AlloyDB | `odcr[databricks]` `[bigquery]` `[postgres]` |
73
+ | **Multi-cloud** | **Snowflake**, **MongoDB** / Atlas | `odcr[snowflake]` `[mongodb]` |
74
+
75
+ 18 adapters; `pip install "odcr[all]"` installs every driver. Each has a ready-to-run reference project in
76
+ [`examples/`](examples/) and a [documentation page](https://sulfibashy.github.io/odcr/adapters/).
77
+ **Informatica, Ab Initio, Azure Data Factory, SSIS, Airflow and Databricks Workflows** call odcr after they land
78
+ data — see [Integrations](https://sulfibashy.github.io/odcr/integrations/).
79
+
80
+ ## A contract
81
+
82
+ ```yaml
83
+ apiVersion: v3.0.2
84
+ kind: DataContract
85
+ id: orders
86
+ version: 1.0.0
87
+ support: # the source team is notified here
88
+ - {channel: "#orders-alerts", tool: slack, url: "${ORDERS_SLACK_WEBHOOK}"}
89
+ - {channel: orders, tool: teams, url: "${ORDERS_TEAMS_WEBHOOK}"}
90
+ - {channel: orders-team@example.com, tool: email, url: "mailto:orders-team@example.com"}
91
+ schema:
92
+ - name: orders
93
+ physicalName: sales.orders # or abfss://landing@lake.dfs.core.windows.net/orders/*.parquet
94
+ properties:
95
+ - {name: order_id, logicalType: integer, primaryKey: true}
96
+ - name: status
97
+ logicalType: string
98
+ quality:
99
+ - {type: library, metric: invalidValues, arguments: {validValues: [NEW, PAID, SHIPPED]}, mustBe: 0}
100
+ - name: amount
101
+ logicalType: number
102
+ quality:
103
+ - {type: library, metric: nullValues, mustBeLessOrEqualTo: 1, unit: percent, severity: warning}
104
+ quality:
105
+ - {type: library, metric: rowCount, mustBeGreaterThan: 0}
106
+ - {type: sql, query: "SELECT COUNT(*) FROM {object} WHERE amount < 0", mustBe: 0}
107
+ ```
108
+
109
+ ## Runs everywhere
110
+
111
+ - **Operating systems:** Windows, macOS, Linux and Unix servers — tested in CI on all three major ones.
112
+ - **Install:** `pip`, `pipx`, offline wheelhouses for air-gapped servers, the [Dockerfile](Dockerfile), Databricks
113
+ libraries, Azure Functions, AWS Lambda.
114
+ - **Security:** TLS with verified certificates by default; corporate CA bundles and proxies; secrets from
115
+ environment variables, `.env` or secret files; managed identities, IAM roles, key-pair and OAuth. See
116
+ [Security](https://sulfibashy.github.io/odcr/security/).
117
+
118
+ ## Python API
119
+
120
+ ```python
121
+ from odcr import ContractRepository, run_contract
122
+ from odcr.adapters import get_adapter
123
+ from odcr.config import load_config
124
+
125
+ config = load_config("odcr.yaml")
126
+ contract = ContractRepository.from_config(config).get("orders")
127
+ with get_adapter(config.connection("main")) as db:
128
+ result = run_contract(contract, db, config, batch_id="42", where="load_id = '42'")
129
+ if not result.passed:
130
+ raise SystemExit(result.summary())
131
+ ```
132
+
133
+ Airflow: `from odcr.integrations.airflow import OdcrContractOperator`.
134
+
135
+ ## Contributing
136
+
137
+ odcr is community-built. Adapters are the easiest way in: [adding one](docs/contributing/adding-an-adapter.md)
138
+ is ~50 lines, and the whole end-to-end suite then runs against your platform. Start with
139
+ [CONTRIBUTING.md](CONTRIBUTING.md) and issues labelled `good first issue`.
140
+
141
+ Licensed under the [Apache License 2.0](LICENSE).