Skip to main content

Collects data from multiple MySQL Databases in a multi-tenant architecture

Project description

Gatherer

Collects data from multiple MySQL Databases in a multi-tenant architecture. Gatherer helps to gather the scattered data across different databases which share the same schema. It outputs the whole collected data into a single CSV file.

Pip

You can install this package from pip by running the following command :

pip install gatherer

Pros

  • Cuts out the need of performing a manual job by executing your query on each database and then merging them.

  • No wait for huge response which may fail or exceed different limits.

  • Specific databases may be excluded.

  • Huge and complex queries can be read from a file.

  • Catalog can be loaded from three different sources (manual list, the same instance as tenant, the remote instance).

  • Eliminates the need of advanced knowledge in cross-database queries.

  • The process can be terminated at any time, and it can be restarted later.

Parameters

Name | Description | Type | Default

--- | --- | --- | ---

host | The MySQL Instance IP/Identifier of Tenant Database/s (or all-with Catalog). | string | localhost

user | The MySQL Instance User of Tenant Databases (or all-with-Catalog). | string | root

password | The MySQL Instance Password of Tenant Databases (or all-with-Catalog). | string | Empty

port | The MySQL Instance Port of Tenant Databases (or all-with-Catalog). | integer | 3306

output_dir | Each tenant file will be stored here before the final merge. Consider it as a temporary database. | string | output_dir

tenant_query | The SELECT query to be performed. | string | None

tenant_query_source | The SELECT query to be performed from file. | string | None

tenant_dbs | Databases given manually. If this is set then Catalog parameters will not be taken into consideration. | array | None

skip_tenant_dbs | Tenant Databases to be skipped. | string | None

catalog_db | The Catalog Database. The Catalog Query will be executed here. | string | None

catalog_query | The Query to SELECT Tenants Database names. | string | None

catalog_host | The MySQL Instance IP/Identifier of Catalog. | string | None

catalog_user | Catalog host User. | string | None

catalog_password | Catalog host Password | string | None

output_file_name | The name of the file which contains the final result. | string | output

skip_processed_tenants | Tenant Databases to be skipped. | string | None

file_encoding | The File Encoding to be used in final CSV. | string | latin-1

file_headers | The Headers in final CSV file. | string | latin-1

debug | Debug the process on console. | boolean | False

How it works

Collector runs a given query in each tenant database which is present in its {list}, this list is either given manually (filled with Database names) or fetched automatically by a given Catalog query.

Each of these runs yields a result which is outputted into a CSV file in {output_dir}. At the end of this, all files are merged into a single one.

Simple usage

import gatherer



gatherer.gather(host='localhost',

                  user='root',

                  password='',

                  port=3306,

                  tenant_query='SELECT my_column_1,my_column_2,my_column_3 FROM my_table;',

                  skip_tenant_dbs=['My_Tenant1_DB', 'My_Tenant2_DB'],

                  catalog_db='CATALOG_DB',

                  catalog_query='SELECT my_tenant_database_name FROM my_tenants;',

                  output_dir='temp_output'

                  )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gatherer-0.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

gatherer-0.0.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file gatherer-0.0.1.tar.gz.

File metadata

  • Download URL: gatherer-0.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/3.7.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.0

File hashes

Hashes for gatherer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0ca2fd2c952d6c6b34e84bd699da55707827ab3773a1136585f8a71ed038728b
MD5 aade4381c43d1118b46efd86863f659a
BLAKE2b-256 657c791e1a31a561693bb13fba1a263bbf3a929cbdd30da9ff96adbe01d0a616

See more details on using hashes here.

File details

Details for the file gatherer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gatherer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.3 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/3.7.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.0

File hashes

Hashes for gatherer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b0d3b926bcf9f936fc7f88c3365f6e68c5f048e8e8eb87a36d09e749ae8f21de
MD5 75c29cf2e12409918b80b5e4c9535902
BLAKE2b-256 bf4d71386c7ea2fd73a66289391dc152a4432e800b4e1c2d5ded74aad2831b22

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page