Skip to main content

Python Library for connecting to Elasticsearch and loading data into BigQuery.

This Python library provides utilities to extract data from Elasticsearch and load it directly into Google BigQuery. It simplifies the process of data migration between Elasticsearch and BigQuery by handling connection setup, data extraction, and data loading with optional timestamping.

Features

  1. Connect to an Elasticsearch instance and fetch data.
  2. Load data directly into a specified BigQuery table.
  3. Optional timestamping for record insertion.

Installation Install the package via pip:

pip install Elasticsearch_to_BigQuery_Connector

Dependencies

  1. elasticsearch: To connect and interact with Elasticsearch.
  2. google-cloud-bigquery: To handle operations related to BigQuery.

Make sure to have these installed using:

pip install elasticsearch google-cloud-bigquery

Example Usage:

from Elasticsearch_to_BigQuery_Connector import Elasticsearch_to_BigQuery_Connector

Elasticsearch_to_BigQuery_Connector(
    es_index_name='your_index',
    es_host='localhost',
    es_port=port,
    es_scheme='http',
    es_http_auth=('user', 'pass'),
    es_size=size,
    bq_project_id='your_project_id',
    bq_dataset_id='your_dataset_id',
    bq_table_name='your_table_name',
    bq_add_record_addition_time=True
)

Parameters:

  1. index_name (str): The name of the Elasticsearch index to query.
  2. host (str): The hostname of the Elasticsearch server.
  3. port (int): The port number on which the Elasticsearch server is listening.
  4. scheme (str): The protocol scheme (e.g., 'http' or 'https').
  5. http_auth (tuple): A tuple containing the username and password for basic auth.
  6. size (int, optional): The number of records to fetch in one query (default is 10000).
  7. bq_project_id (str): The Google Cloud project ID.
  8. bq_dataset_id (str): The dataset ID within the Google Cloud project.
  9. bq_table_name (str): The table name where the data will be loaded.
  10. bq_add_record_addition_time (bool): If True, adds the current datetime as landloaddate to each record.

Additional Notes:

Ensure you have configured credentials for both Elasticsearch and Google Cloud (BigQuery):

  1. For Elasticsearch, provide the host, port, scheme, and authentication details.
  2. For BigQuery, ensure your environment is set up with the appropriate credentials (using Google Cloud SDK or setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to your service account key file).

Metadata

Release files for Elasticsearch-to-BigQuery-Connector 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Elasticsearch-to-BigQuery-Connector 0.1
File Size Uploaded
Elasticsearch_to_BigQuery_Connector-0.1.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Elasticsearch-to-BigQuery-Connector 0.1
File Interpreter ABI Platform
Elasticsearch_to_BigQuery_Connector-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.0 kB

Release files / Elasticsearch_to_BigQuery_Connector-0.1.tar.gz

Download URL Elasticsearch_to_BigQuery_Connector-0.1.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c1dd47cbe801f254da11498d0caab7ea33d2a5a55aadb2ad95ae180f490cf635
BLAKE2b-256 checksum
How to use checksums
006218050ac1a634d608c65849a10ab59e3709b835a395516af2df763b38e3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / Elasticsearch_to_BigQuery_Connector-0.1-py3-none-any.whl

Download URL Elasticsearch_to_BigQuery_Connector-0.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0be3ef118a2b5a4c97a683e47570d7fc4fa74c09cd98fdc4b79c4a0d4a1ed7d4
BLAKE2b-256 checksum
How to use checksums
031d877fb72d9ab10b13fcf1c4374bb514c0377442d1110b2701d7dc786872b5
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.1 This release

2 release files

0.0

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