recce 0.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 (49) hide show
  1. recce-0.1.0/LICENSE +201 -0
  2. recce-0.1.0/PKG-INFO +143 -0
  3. recce-0.1.0/README.md +104 -0
  4. recce-0.1.0/recce/VERSION +1 -0
  5. recce-0.1.0/recce/__init__.py +28 -0
  6. recce-0.1.0/recce/cli.py +100 -0
  7. recce-0.1.0/recce/data/404.html +1 -0
  8. recce-0.1.0/recce/data/_next/static/MgbS0YsrggPnHKd-Iqmwr/_buildManifest.js +1 -0
  9. recce-0.1.0/recce/data/_next/static/MgbS0YsrggPnHKd-Iqmwr/_ssgManifest.js +1 -0
  10. recce-0.1.0/recce/data/_next/static/chunks/01f7335f-db39a7846fa358b4.js +1 -0
  11. recce-0.1.0/recce/data/_next/static/chunks/138-f3bfd17a93c411aa.js +339 -0
  12. recce-0.1.0/recce/data/_next/static/chunks/2d02f0f7-cf6b4c6781d22d33.js +1 -0
  13. recce-0.1.0/recce/data/_next/static/chunks/526a6206-fe341f807ef81f7f.js +1 -0
  14. recce-0.1.0/recce/data/_next/static/chunks/5e9a126f-da62af62011c0643.js +1 -0
  15. recce-0.1.0/recce/data/_next/static/chunks/62-29667ac44b8cb237.js +25 -0
  16. recce-0.1.0/recce/data/_next/static/chunks/6dc81886-a3fa8efdc3652e8f.js +1 -0
  17. recce-0.1.0/recce/data/_next/static/chunks/app/_not-found-dc0eba1b03268431.js +1 -0
  18. recce-0.1.0/recce/data/_next/static/chunks/app/layout-c159ba5715e8f184.js +1 -0
  19. recce-0.1.0/recce/data/_next/static/chunks/app/page-0af7594014018834.js +1 -0
  20. recce-0.1.0/recce/data/_next/static/chunks/f0cfc0e7-c90abb11ccf11129.js +9 -0
  21. recce-0.1.0/recce/data/_next/static/chunks/framework-f780fd9bae3b8c58.js +25 -0
  22. recce-0.1.0/recce/data/_next/static/chunks/main-01494d5774218692.js +1 -0
  23. recce-0.1.0/recce/data/_next/static/chunks/main-app-3297e27de57b3a96.js +1 -0
  24. recce-0.1.0/recce/data/_next/static/chunks/pages/_app-97b950e56cb06d37.js +1 -0
  25. recce-0.1.0/recce/data/_next/static/chunks/pages/_error-53b6bd498e76608f.js +1 -0
  26. recce-0.1.0/recce/data/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js +1 -0
  27. recce-0.1.0/recce/data/_next/static/chunks/webpack-791660dd39f36bc1.js +1 -0
  28. recce-0.1.0/recce/data/_next/static/css/bf6846e4cc6de1c9.css +14 -0
  29. recce-0.1.0/recce/data/favicon.ico +0 -0
  30. recce-0.1.0/recce/data/index.html +23 -0
  31. recce-0.1.0/recce/data/index.txt +9 -0
  32. recce-0.1.0/recce/dbt.py +210 -0
  33. recce-0.1.0/recce/diff.py +32 -0
  34. recce-0.1.0/recce/event/CONFIG +1 -0
  35. recce-0.1.0/recce/event/SENTRY_DNS +1 -0
  36. recce-0.1.0/recce/event/__init__.py +164 -0
  37. recce-0.1.0/recce/event/collector.py +129 -0
  38. recce-0.1.0/recce/event/track.py +102 -0
  39. recce-0.1.0/recce/server.py +101 -0
  40. recce-0.1.0/recce/yaml/__init__.py +58 -0
  41. recce-0.1.0/recce.egg-info/PKG-INFO +143 -0
  42. recce-0.1.0/recce.egg-info/SOURCES.txt +47 -0
  43. recce-0.1.0/recce.egg-info/dependency_links.txt +1 -0
  44. recce-0.1.0/recce.egg-info/entry_points.txt +2 -0
  45. recce-0.1.0/recce.egg-info/requires.txt +21 -0
  46. recce-0.1.0/recce.egg-info/top_level.txt +1 -0
  47. recce-0.1.0/setup.cfg +4 -0
  48. recce-0.1.0/setup.py +66 -0
  49. recce-0.1.0/tests/test_dbt.py +24 -0
recce-0.1.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 2023 InfuseAI Inc.
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.
recce-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.1
2
+ Name: recce
3
+ Version: 0.1.0
4
+ Summary: Environment diff tool for dbt
5
+ Home-page: https://github.com/InfuseAI/recce
6
+ Author: InfuseAI Dev Team
7
+ Author-email: dev@infuseai.io
8
+ Project-URL: Bug Tracker, https://github.com/InfuseAI/recce/issues
9
+ Classifier: Programming Language :: Python :: 3.8
10
+ Classifier: Programming Language :: Python :: 3.9
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Development Status :: 4 - Beta
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: ruamel.yaml<0.18.0
20
+ Requires-Dist: click>=7.1
21
+ Requires-Dist: dbt-core>=1.3
22
+ Requires-Dist: pandas
23
+ Requires-Dist: portalocker
24
+ Requires-Dist: fastapi
25
+ Requires-Dist: itsdangerous
26
+ Requires-Dist: uvicorn
27
+ Requires-Dist: pydantic
28
+ Requires-Dist: jinja2
29
+ Requires-Dist: requests>=2.28.1
30
+ Requires-Dist: rich>=12.0.0
31
+ Requires-Dist: sentry-sdk
32
+ Provides-Extra: dev
33
+ Requires-Dist: pytest>=4.6; extra == "dev"
34
+ Requires-Dist: pytest-flake8; extra == "dev"
35
+ Requires-Dist: flake8==3.9.2; extra == "dev"
36
+ Requires-Dist: pytest-mypy; extra == "dev"
37
+ Requires-Dist: pytest-cov; extra == "dev"
38
+ Requires-Dist: twine; extra == "dev"
39
+
40
+ # recce
41
+
42
+ `recce` is a environment diff tool for dbt
43
+
44
+ ## Features
45
+
46
+ 1. Support both Web UI & CLI
47
+ 1. Multiple diff tools, including lineage diff, schema diff, and query diff. And more in the future.
48
+ 1. Use the dbt-core adapter framework to connect to your data warehouse. No additional configuration required.
49
+
50
+ ## Use cases
51
+
52
+ 1. During development, we can verify new results by contrasting them with those from production prior to pushing the changes.
53
+ 2. While reviewing PR, you can grasp the extent of the changes and their impact before merge.
54
+ 3. For troubleshooting, you can execute ad-hoc diff queries to pinpoint the root causes.
55
+
56
+ # Usage
57
+
58
+ ## Prerequisites
59
+
60
+ You have to have at least two [environments](https://docs.getdbt.com/docs/core/dbt-core-environments) in your dbt project. For example, one is for developing and another is for production. You can prepare two targets with separate [schemas](https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles#understanding-target-schemas) in you dbt profile. Here is `profiles.yml` example
61
+
62
+ ```
63
+ jaffle_shop:
64
+ target: dev
65
+ outputs:
66
+ dev:
67
+ type: duckdb
68
+ path: jaffle_shop.duckdb
69
+ schema: dev
70
+ prod:
71
+ type: duckdb
72
+ path: jaffle_shop.duckdb
73
+ schema: main
74
+ ```
75
+
76
+ ## Getting Started
77
+
78
+ [5 minutes walkthrough by jaffle shop example](./docs/get-started-jaffle-shop.md)
79
+
80
+ 1. Installation
81
+
82
+ ```
83
+ pip install recce
84
+ ```
85
+
86
+ 1. Go to your dbt project
87
+ ```
88
+ cd your-dbt-project/
89
+ ```
90
+ 1. **Prepare base artifacts**: DBT generates [artifacts](https://docs.getdbt.com/reference/artifacts/dbt-artifacts) when every invocation. You can find these files in the `target/` folder.
91
+
92
+ | artifacts | dbt command |
93
+ | ----------------------- | -------------------------- |
94
+ | manifest.json | `dbt run`, `dbt build`, .. |
95
+ | catalog.json (optional) | `dbt docs generate` |
96
+
97
+ Copy the artifacts for base environment to `target-base/`
98
+
99
+ 1. Run the recce server.
100
+
101
+ ```
102
+ recce server
103
+ ```
104
+
105
+ Recce would diff environments between `target/` and `target-base/`
106
+
107
+ ## Query Diff
108
+
109
+ You can run query diff in both Web UI and CLI
110
+
111
+ - **Web UI**: Go to **Query** tab
112
+
113
+ ```jinja
114
+ select * from {{ ref("mymodel") }}
115
+ ```
116
+
117
+ - **CLI**:
118
+
119
+ ```shell
120
+ recce diff --sql 'select * from {{ ref("mymodel") }}'
121
+ ```
122
+
123
+ ### Primay key
124
+
125
+ In the query diff, primary key columns serve as the fundamental identifiers for distinguishing each record uniquely across both sides.
126
+
127
+ - **Web UI**: In the query result, click the _key_ icons in the column headers to toggle if it is in the primary key list.
128
+
129
+ - **CLI**: Use the option `--primary-keys` to specify the primary keys. Use comma to separate the columns if it is a compound key.
130
+
131
+ ```shell
132
+ recce diff --primary-keys event_id --sql 'select * from {{ ref("events") }} order by 1'
133
+ ```
134
+
135
+ # Q&A
136
+
137
+ ### Q: How `recce` connect to my data warehouse? Does recce support my data warehouse?
138
+
139
+ `recce` use the [dbt adapter](https://docs.getdbt.com/docs/connect-adapters) to connect to your warehouse. So it should work for your data warehouse.
140
+
141
+ ### Q: What credential does `recce` connect to the two environments?
142
+
143
+ Recce uses the same target in the profile to connect your warehouse. If you use the default target `dev`, it use the credentials to connect to both environments. So please make sure that the credential able to access both environments.
recce-0.1.0/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # recce
2
+
3
+ `recce` is a environment diff tool for dbt
4
+
5
+ ## Features
6
+
7
+ 1. Support both Web UI & CLI
8
+ 1. Multiple diff tools, including lineage diff, schema diff, and query diff. And more in the future.
9
+ 1. Use the dbt-core adapter framework to connect to your data warehouse. No additional configuration required.
10
+
11
+ ## Use cases
12
+
13
+ 1. During development, we can verify new results by contrasting them with those from production prior to pushing the changes.
14
+ 2. While reviewing PR, you can grasp the extent of the changes and their impact before merge.
15
+ 3. For troubleshooting, you can execute ad-hoc diff queries to pinpoint the root causes.
16
+
17
+ # Usage
18
+
19
+ ## Prerequisites
20
+
21
+ You have to have at least two [environments](https://docs.getdbt.com/docs/core/dbt-core-environments) in your dbt project. For example, one is for developing and another is for production. You can prepare two targets with separate [schemas](https://docs.getdbt.com/docs/core/connect-data-platform/connection-profiles#understanding-target-schemas) in you dbt profile. Here is `profiles.yml` example
22
+
23
+ ```
24
+ jaffle_shop:
25
+ target: dev
26
+ outputs:
27
+ dev:
28
+ type: duckdb
29
+ path: jaffle_shop.duckdb
30
+ schema: dev
31
+ prod:
32
+ type: duckdb
33
+ path: jaffle_shop.duckdb
34
+ schema: main
35
+ ```
36
+
37
+ ## Getting Started
38
+
39
+ [5 minutes walkthrough by jaffle shop example](./docs/get-started-jaffle-shop.md)
40
+
41
+ 1. Installation
42
+
43
+ ```
44
+ pip install recce
45
+ ```
46
+
47
+ 1. Go to your dbt project
48
+ ```
49
+ cd your-dbt-project/
50
+ ```
51
+ 1. **Prepare base artifacts**: DBT generates [artifacts](https://docs.getdbt.com/reference/artifacts/dbt-artifacts) when every invocation. You can find these files in the `target/` folder.
52
+
53
+ | artifacts | dbt command |
54
+ | ----------------------- | -------------------------- |
55
+ | manifest.json | `dbt run`, `dbt build`, .. |
56
+ | catalog.json (optional) | `dbt docs generate` |
57
+
58
+ Copy the artifacts for base environment to `target-base/`
59
+
60
+ 1. Run the recce server.
61
+
62
+ ```
63
+ recce server
64
+ ```
65
+
66
+ Recce would diff environments between `target/` and `target-base/`
67
+
68
+ ## Query Diff
69
+
70
+ You can run query diff in both Web UI and CLI
71
+
72
+ - **Web UI**: Go to **Query** tab
73
+
74
+ ```jinja
75
+ select * from {{ ref("mymodel") }}
76
+ ```
77
+
78
+ - **CLI**:
79
+
80
+ ```shell
81
+ recce diff --sql 'select * from {{ ref("mymodel") }}'
82
+ ```
83
+
84
+ ### Primay key
85
+
86
+ In the query diff, primary key columns serve as the fundamental identifiers for distinguishing each record uniquely across both sides.
87
+
88
+ - **Web UI**: In the query result, click the _key_ icons in the column headers to toggle if it is in the primary key list.
89
+
90
+ - **CLI**: Use the option `--primary-keys` to specify the primary keys. Use comma to separate the columns if it is a compound key.
91
+
92
+ ```shell
93
+ recce diff --primary-keys event_id --sql 'select * from {{ ref("events") }} order by 1'
94
+ ```
95
+
96
+ # Q&A
97
+
98
+ ### Q: How `recce` connect to my data warehouse? Does recce support my data warehouse?
99
+
100
+ `recce` use the [dbt adapter](https://docs.getdbt.com/docs/connect-adapters) to connect to your warehouse. So it should work for your data warehouse.
101
+
102
+ ### Q: What credential does `recce` connect to the two environments?
103
+
104
+ Recce uses the same target in the profile to connect your warehouse. If you use the default target `dev`, it use the credentials to connect to both environments. So please make sure that the credential able to access both environments.
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,28 @@
1
+ import os
2
+ import sys
3
+
4
+
5
+ def is_ci_env():
6
+ # some CI service puts the "CI" var
7
+ if os.environ.get('CI', 'false') == 'true':
8
+ return True
9
+
10
+ # For CiecleCI exceptions
11
+ if os.environ.get('CIRCLECI', 'false') == 'true':
12
+ return True
13
+
14
+ # if not tty, it probably runs automatically
15
+ if not sys.stdout.isatty():
16
+ return True
17
+
18
+ return False
19
+
20
+
21
+ def get_version():
22
+ version_file = os.path.normpath(os.path.join(os.path.dirname(__file__), 'VERSION'))
23
+ with open(version_file) as fh:
24
+ version = fh.read().strip()
25
+ return version
26
+
27
+
28
+ __version__ = get_version()
@@ -0,0 +1,100 @@
1
+ from typing import List
2
+
3
+ import click
4
+
5
+ from recce import event
6
+ from .dbt import DBTContext
7
+ from .event.track import TrackCommand
8
+
9
+ event.init()
10
+
11
+
12
+ @click.group()
13
+ @click.pass_context
14
+ def cli(ctx, **kwargs):
15
+ """Environment diff tool for DBT"""
16
+
17
+
18
+ @cli.command(cls=TrackCommand)
19
+ def version():
20
+ """
21
+ Show version information
22
+ """
23
+ from recce import __version__
24
+ print(__version__)
25
+
26
+
27
+ @cli.command(cls=TrackCommand)
28
+ @click.option('--sql', help='Sql template to query', required=True)
29
+ @click.option('--base', is_flag=True, help='Run the query on the base environment')
30
+ def query(sql, base: bool = False):
31
+ """
32
+ Run a query on the current or base environment
33
+
34
+ Examples:\n
35
+
36
+ - run an adhoc query\n
37
+ recce query --sql 'select * from {{ ref("mymodel") }} order by 1'
38
+
39
+ - run an adhoc query on base environment\n
40
+ recce query --base --sql 'select * from {{ ref("mymodel") }} order by 1'
41
+ """
42
+ dbt_context = DBTContext.load()
43
+ result = dbt_context.execute_sql(sql, base=base)
44
+ print(result.to_string(na_rep='-', index=False))
45
+
46
+
47
+ def _split_comma_separated(ctx, param, value):
48
+ return value.split(',') if value else None
49
+
50
+
51
+ @cli.command(cls=TrackCommand)
52
+ @click.option('--sql', help='Sql template to query.', required=True)
53
+ @click.option('--primary-keys', type=click.STRING, help='Comma-separated list of primary key columns.',
54
+ callback=_split_comma_separated)
55
+ @click.option('--keep-shape', is_flag=True, help='Keep unchanged columns. Otherwise, unchanged columns are hidden.')
56
+ @click.option('--keep-equal', is_flag=True,
57
+ help='Keep values that are equal. Otherwise, equal values are shown as "-".')
58
+ def diff(sql, primary_keys: List[str] = None, keep_shape: bool = False, keep_equal: bool = False):
59
+ """
60
+ Run queries on base and current environments and diff the results
61
+
62
+ Examples:\n
63
+
64
+ - run adhoc queries and diff the results\n
65
+ recce diff --sql 'select * from {{ ref("mymodel") }} order by 1'
66
+ """
67
+
68
+ dbt_context = DBTContext.load()
69
+ before = dbt_context.execute_sql(sql, base=True)
70
+ if primary_keys is not None:
71
+ before.set_index(primary_keys, inplace=True)
72
+ after = dbt_context.execute_sql(sql, base=False)
73
+ if primary_keys is not None:
74
+ after.set_index(primary_keys, inplace=True)
75
+
76
+ before_aligned, after_aligned = before.align(after)
77
+ diff = before_aligned.compare(after_aligned,
78
+ result_names=('base', 'current'),
79
+ keep_equal=keep_equal,
80
+ keep_shape=keep_shape)
81
+ print(diff.to_string(na_rep='-') if not diff.empty else 'no changes')
82
+
83
+
84
+ @cli.command(cls=TrackCommand)
85
+ @click.option('--host', default='0.0.0.0', show_default=True, help='The host to bind to.')
86
+ @click.option('--port', default=8000, show_default=True, help='The port to bind to.', type=int)
87
+ def server(host, port):
88
+ """
89
+ Launch the recce server
90
+ """
91
+
92
+ import uvicorn
93
+ from .server import load_dbt_context, app
94
+
95
+ load_dbt_context()
96
+ uvicorn.run(app, host=host, port=port)
97
+
98
+
99
+ if __name__ == "__main__":
100
+ cli()
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-791660dd39f36bc1.js" crossorigin=""/><script src="/_next/static/chunks/f0cfc0e7-c90abb11ccf11129.js" async="" crossorigin=""></script><script src="/_next/static/chunks/62-29667ac44b8cb237.js" async="" crossorigin=""></script><script src="/_next/static/chunks/main-app-3297e27de57b3a96.js" async="" crossorigin=""></script><title>404: This page could not be found.</title><title>recce</title><meta name="description" content="Recce: a dbt tool"/><script src="/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script></head><body><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-791660dd39f36bc1.js" crossorigin="" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"0:\"$L1\"\n"])</script><script>self.__next_f.push([1,"2:I[61886,[],\"\"]\n4:I[35774,[],\"\"]\n5:I[44813,[],\"\"]\n6:I[82593,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontW"])</script><script>self.__next_f.push([1,"eight\":400,\"lineHeight\":\"49px\",\"margin\":0}\n"])</script><script>self.__next_f.push([1,"1:[null,[\"$\",\"$L2\",null,{\"buildId\":\"MgbS0YsrggPnHKd-Iqmwr\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/_not-found\",\"initialTree\":[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],\"initialHead\":[false,\"$L3\"],\"globalErrorComponent\":\"$4\",\"children\":[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"suppressHydrationWarning\":true,\"children\":[\"$\",\"$L5\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L6\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"childProp\":{\"current\":[\"$L7\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],null],\"segment\":\"__PAGE__\"},\"styles\":null}]}]}],null]}]]\n"])</script><script>self.__next_f.push([1,"3:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"recce\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Recce: a dbt tool\"}]]\n7:null\n"])</script><script>self.__next_f.push([1,""])</script></body></html>
@@ -0,0 +1 @@
1
+ self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-53b6bd498e76608f.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1 @@
1
+ self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()