BigQuery Email Extractor is a Python library designed to extract data from a Google BigQuery table and send it as a CSV attachment via email. This library simplifies the process of exporting data from BigQuery and distributing it through email.
Features
- Extracts data from a specified BigQuery table.
- Converts the extracted data to a CSV format.
- Sends the CSV data as an email attachment.
- Configurable email settings for SMTP server, port, and credentials.
Requirements
- Python 3.x
- Google Cloud BigQuery client library
- pandas library
- smtplib for sending emails
Installation Install the package via pip:
pip install bigquery-email-extractor
Dependencies
Make sure to have these installed using:
pip install google-cloud-bigquery pandas
Example Usage:
from bigquery_email_extractor import bigquery_email_extractor
bigquery_email_extractor(
BQ_PROJECT_ID='your-project-id',
BQ_DATASET_ID='your-dataset-id',
BQ_TABLE_ID='your-table-id',
RECIPIENT_EMAIL='recipient@example.com',
SMTP_SERVER='smtp.example.com',
SMTP_PORT=587,
SMTP_USER='your-smtp-user',
SMTP_PASSWORD='your-smtp-password',
EMAIL_SUBJECT='BigQuery Data',
EMAIL_BODY='Please find the attached BigQuery data.',
ATTACHMENT_FILENAME='data.csv'
)
Parameters:
- BQ_PROJECT_ID (str): The BigQuery project ID.
- BQ_DATASET_ID (str): The BigQuery dataset ID.
- BQ_TABLE_ID (str): The BigQuery table ID.
- RECIPIENT_EMAIL (str): The recipient email address.
- SMTP_SERVER (str): The SMTP server for sending emails.
- SMTP_PORT (int): The port for the SMTP server.
- SMTP_USER (str): The SMTP server user.
- SMTP_PASSWORD (str): The SMTP server password.
- EMAIL_SUBJECT (str): The subject of the email.
- EMAIL_BODY (str): The body of the email.
- ATTACHMENT_FILENAME (str): The filename for the CSV attachment.
Acknowledgements
- Google Cloud BigQuery Python Client Library
- pandas for data manipulation
- smtplib for email handling
For any issues or questions, please open an issue in this repository.
Metadata
Release files for Bigquery-Email-extractor 0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Bigquery_Email_extractor-0.0.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Bigquery_Email_extractor-0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / Bigquery_Email_extractor-0.0.tar.gz
| Download URL | Bigquery_Email_extractor-0.0.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dad9e13bd2f555c3b076ca76399afff5ac6f7329277708aaf7cb103795506f24
|
|
BLAKE2b-256 checksum How to use checksums |
daba619525e98f2c4872ca8b62ec2a7e4a0bf41f66da81dedbe4fbb63fe9be27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / Bigquery_Email_extractor-0.0-py3-none-any.whl
| Download URL | Bigquery_Email_extractor-0.0-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f4912c54a9cc0e3a77e6681589e905d048b09faa405cf65499f759c75a28adc
|
|
BLAKE2b-256 checksum How to use checksums |
024ac33c0eecc13d4cfcae539a165692a0669617e7e92666b18a3263001fbb33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|