Bigquery_dependency_email_trigger is a Python library that monitors the results of a BigQuery dependency query and sends email notifications based on the outcome. It is designed to help users automate and manage dependency checks and receive alerts via email.
Features
- Monitors BigQuery dependency query results.
- Sends warning emails if the expected result is not met within a specified number of tries.
- Sends error emails if the maximum number of tries is exceeded without meeting the expected result.
- Configurable retry intervals and email contents.
Installation
Install the library using pip:
pip install bigquery-dependency-email-trigger
Usage Here's an example of how to use the bigquery_dependency_email_trigger function:
import time
import pandas_gbq
from bigquery_dependency_email_trigger import bigquery_dependency_email_trigger
# Set up parameters
dependency_query = "SELECT COUNT(*) FROM `project.dataset.table` WHERE condition"
project = "your-gcp-project-id"
expected_dependent_result = "expected-result"
number_of_tries = 10
num_of_tries_before_warn_email = 5
time_interval = 60 # Time interval in seconds
warn_email_content = "Warning: Dependency check not met"
warn_email_subject = "Warning: Dependency Check"
email_address = "recipient@example.com"
error_email_content = "Error: Dependency check failed"
error_email_subject = "Error: Dependency Check Failed"
SMTP_SERVER = "smtp.example.com"
SMTP_PORT = 587
SENDER_EMAIL = "sender@example.com"
SMTP_USER = "smtp-user"
SMTP_PASSWORD = "smtp-password"
# Trigger dependency check
result = bigquery_dependency_email_trigger(
dependency_query, project, expected_dependent_result,
number_of_tries, num_of_tries_before_warn_email, time_interval,
warn_email_content, warn_email_subject, email_address, error_email_content, error_email_subject,
SMTP_SERVER, SMTP_PORT, SENDER_EMAIL, SMTP_USER, SMTP_PASSWORD
)
if result:
print("Dependency met successfully.")
else:
print("Dependency check failed.")
Parameters:
- dependency_query: SQL query to run on BigQuery to check for dependency.
- project: GCP project ID.
- expected_dependent_result: Expected result of the dependency query.
- number_of_tries: Number of times to retry the query.
- num_of_tries_before_warn_email: Number of tries before sending a warning email.
- time_interval: Time interval between retries (in seconds).
- warn_email_content: Content of the warning email.
- warn_email_subject: Subject of the warning email.
- email_address: Recipient email address.
- error_email_content: Content of the error email.
- error_email_subject: Subject of the error email.
- SMTP_SERVER: SMTP server address.
- SMTP_PORT: SMTP server port.
- SENDER_EMAIL: Sender email address.
- SMTP_USER: SMTP server user.
- SMTP_PASSWORD: SMTP server password.
Metadata
Release files for Bigquery-dependency-email-trigger 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| Bigquery_dependency_email_trigger-0.1.tar.gz | 3.7 kB | Without provenance | Details for Bigquery_dependency_email_trigger-0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| Bigquery_dependency_email_trigger-0.1-py3-none-any.whl | Python 3 | none | any | Details for Bigquery_dependency_email_trigger-0.1-py3-none-any.whl |
Total release size: 8.5 kB
Release files / Bigquery_dependency_email_trigger-0.1.tar.gz
| Download URL | Bigquery_dependency_email_trigger-0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afd503e95c33b17029d76efc8e974ab30e4b740231c989909e3ee7a048c569e2
|
|
BLAKE2b-256 checksum How to use checksums |
bdc10c4cea1a4035a4362fdc0a970452d47e28790b01e5a7352b391ddd4bb48b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / Bigquery_dependency_email_trigger-0.1-py3-none-any.whl
| Download URL | Bigquery_dependency_email_trigger-0.1-py3-none-any.whl |
|---|---|
| Size | 4.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
441b24a8d06a53f8d3610ee54195c6756e1564a619ffa40a3bd04adca732035f
|
|
BLAKE2b-256 checksum How to use checksums |
091009698826da02a22ea7720d0faec48720021902bdc9aff4f1befe1f73e038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for Bigquery-dependency-email-trigger 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.