pycarlo 0.12.18__py3-none-any.whl → 0.12.64__py3-none-any.whl
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.
Potentially problematic release.
This version of pycarlo might be problematic. Click here for more details.
- pycarlo/lib/schema.json +34462 -28315
- pycarlo/lib/schema.py +2892 -1018
- {pycarlo-0.12.18.dist-info → pycarlo-0.12.64.dist-info}/METADATA +61 -7
- {pycarlo-0.12.18.dist-info → pycarlo-0.12.64.dist-info}/RECORD +7 -7
- {pycarlo-0.12.18.dist-info → pycarlo-0.12.64.dist-info}/LICENSE +0 -0
- {pycarlo-0.12.18.dist-info → pycarlo-0.12.64.dist-info}/WHEEL +0 -0
- {pycarlo-0.12.18.dist-info → pycarlo-0.12.64.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pycarlo
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.64
|
|
4
4
|
Summary: Monte Carlo's Python SDK
|
|
5
5
|
Home-page: https://www.montecarlodata.com/
|
|
6
6
|
Author: Monte Carlo Data, Inc
|
|
@@ -143,7 +143,65 @@ print(client(mutation))
|
|
|
143
143
|
|
|
144
144
|
### Examples
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
#### Circuit Breaker Example
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from pycarlo.core import Client, Session
|
|
150
|
+
from pycarlo.features.circuit_breakers import CircuitBreakerService
|
|
151
|
+
|
|
152
|
+
# Example from our test.snowflake account.
|
|
153
|
+
endpoint = "https://api.dev.getmontecarlo.com/graphql"
|
|
154
|
+
|
|
155
|
+
service = CircuitBreakerService(
|
|
156
|
+
mc_client=Client(Session(mcd_profile="test-snow", endpoint=endpoint)), print_func=print
|
|
157
|
+
)
|
|
158
|
+
in_breach = service.trigger_and_poll(rule_uuid="87872875-fe80-4963-8ab0-c04397a6daae")
|
|
159
|
+
print("That can't be good. Our warehouse is broken." if in_breach else "Go, go, go!.")
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
#### Insight Upload Example
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from pathlib import Path
|
|
166
|
+
|
|
167
|
+
import boto3
|
|
168
|
+
import requests
|
|
169
|
+
|
|
170
|
+
from pycarlo.core import Client, Query
|
|
171
|
+
|
|
172
|
+
MC_CLIENT = Client()
|
|
173
|
+
S3_CLIENT = boto3.client("s3")
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def upload_insights_to_s3(
|
|
177
|
+
destination_bucket: str,
|
|
178
|
+
desired_file_extension: str = ".csv",
|
|
179
|
+
) -> None:
|
|
180
|
+
"""
|
|
181
|
+
Example function for listing all insights in an account, and uploading any available
|
|
182
|
+
to S3 as a CSV.
|
|
183
|
+
"""
|
|
184
|
+
list_insights_query = Query()
|
|
185
|
+
list_insights_query.get_insights()
|
|
186
|
+
for insight in MC_CLIENT(list_insights_query).get_insights:
|
|
187
|
+
report_name = str(Path(insight.name).with_suffix(desired_file_extension))
|
|
188
|
+
|
|
189
|
+
if insight.available:
|
|
190
|
+
report_url_query = Query()
|
|
191
|
+
report_url_query.get_report_url(insight_name=insight.name, report_name=report_name)
|
|
192
|
+
report_url = MC_CLIENT(report_url_query).get_report_url.url
|
|
193
|
+
|
|
194
|
+
print(f"Uploading {report_name} to {destination_bucket}.")
|
|
195
|
+
S3_CLIENT.upload_fileobj(
|
|
196
|
+
Fileobj=requests.get(url=report_url, stream=True).raw,
|
|
197
|
+
Bucket=destination_bucket,
|
|
198
|
+
Key=report_name,
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
if __name__ == "__main__":
|
|
203
|
+
upload_insights_to_s3(destination_bucket="<BUCKET-NAME>")
|
|
204
|
+
```
|
|
147
205
|
|
|
148
206
|
See [Monte Carlo's API reference](https://apidocs.getmontecarlo.com/) for all supported queries and
|
|
149
207
|
mutations.
|
|
@@ -232,10 +290,6 @@ raising an error. This allows older SDK versions to continue working when new fe
|
|
|
232
290
|
|
|
233
291
|
To avoid warnings and ensure full feature support, keep your SDK updated to the latest version.
|
|
234
292
|
|
|
235
|
-
## Contributing
|
|
236
|
-
|
|
237
|
-
See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
|
|
238
|
-
|
|
239
293
|
## References
|
|
240
294
|
|
|
241
295
|
- Monte Carlo App: <https://getmontecarlo.com>
|
|
@@ -246,4 +300,4 @@ See [CONTRIBUTING.md](./CONTRIBUTING.md) for details.
|
|
|
246
300
|
|
|
247
301
|
## License
|
|
248
302
|
|
|
249
|
-
Apache 2.0 - See the [
|
|
303
|
+
Apache 2.0 - See the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0) for more information.
|
|
@@ -38,11 +38,11 @@ pycarlo/features/user/queries.py,sha256=m97RvM0oiBlrU5xmOwe_JJ5N0G0NG5hIOeyQqN2O
|
|
|
38
38
|
pycarlo/features/user/service.py,sha256=DHkhuonySaHro07NTd0YNe3cNkDk62CiRTY77dhVaMs,2890
|
|
39
39
|
pycarlo/lib/README.md,sha256=CVVrPPgje7pkXNNsPvwLSeUOm5aktb22MlttmoxX08k,1677
|
|
40
40
|
pycarlo/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
-
pycarlo/lib/schema.json,sha256=
|
|
42
|
-
pycarlo/lib/schema.py,sha256=
|
|
41
|
+
pycarlo/lib/schema.json,sha256=YIhDLzj5Ec0iAOF_sjs4X-4MQp-ik_kT0wM8Yhx1U34,6792739
|
|
42
|
+
pycarlo/lib/schema.py,sha256=LyxaCs49TR-mhULyegA4gbTySAMGA_02wOdtzx_ZNag,2938860
|
|
43
43
|
pycarlo/lib/types.py,sha256=lGOrm5Qm-SieDAkOkVOFSgyUJYGOjKnea961AD9Dv6s,2404
|
|
44
|
-
pycarlo-0.12.
|
|
45
|
-
pycarlo-0.12.
|
|
46
|
-
pycarlo-0.12.
|
|
47
|
-
pycarlo-0.12.
|
|
48
|
-
pycarlo-0.12.
|
|
44
|
+
pycarlo-0.12.64.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
45
|
+
pycarlo-0.12.64.dist-info/METADATA,sha256=Zcnya5JXmJbdDCrFeOxHB-zD_PP_j9kFgLrP6ktWGOE,10431
|
|
46
|
+
pycarlo-0.12.64.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
|
47
|
+
pycarlo-0.12.64.dist-info/top_level.txt,sha256=TIE04H4pgzGaFxAB-gvkmVAUOAoHxxFfhnEcpuQ5bF4,8
|
|
48
|
+
pycarlo-0.12.64.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|