Skip to main content

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

  1. Extracts data from a specified BigQuery table.
  2. Converts the extracted data to a CSV format.
  3. Sends the CSV data as an email attachment.
  4. Configurable email settings for SMTP server, port, and credentials.

Requirements

  1. Python 3.x
  2. Google Cloud BigQuery client library
  3. pandas library
  4. 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:

  1. BQ_PROJECT_ID (str): The BigQuery project ID.
  2. BQ_DATASET_ID (str): The BigQuery dataset ID.
  3. BQ_TABLE_ID (str): The BigQuery table ID.
  4. RECIPIENT_EMAIL (str): The recipient email address.
  5. SMTP_SERVER (str): The SMTP server for sending emails.
  6. SMTP_PORT (int): The port for the SMTP server.
  7. SMTP_USER (str): The SMTP server user.
  8. SMTP_PASSWORD (str): The SMTP server password.
  9. EMAIL_SUBJECT (str): The subject of the email.
  10. EMAIL_BODY (str): The body of the email.
  11. ATTACHMENT_FILENAME (str): The filename for the CSV attachment.

Acknowledgements

  1. Google Cloud BigQuery Python Client Library
  2. pandas for data manipulation
  3. 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)

Source distribution for Bigquery-Email-extractor 0.0
File Size Uploaded
Bigquery_Email_extractor-0.0.tar.gz 3.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Bigquery-Email-extractor 0.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page