Skip to main content

A Meltano target for MySQL.

Project description

target-mysql

target-mysql is a Singer target for Oracle, Build with the Meltano Target SDK.

English | 한국어

Installation

Use PIP for installation:

pip install thk-target-mysql

Or use GitHub Repo:

pipx install git+https://github.com/thkwag/target-mysql.git@main

Configuration

The available configuration options for target-mysql are:

Configuration Options Description Default
host MySQL server's hostname or IP address
port Port where MySQL server is running
user MySQL username
password MySQL user's password
database MySQL database's name
table_name_pattern MySQL table name pattern "${TABLE_NAME}"
lower_case_table_names Use lowercase for table names or not true
allow_column_alter Allow column alterations or not false
replace_null Replace null values with others or not false

Configurations can be stored in a JSON configuration file and specified using the --config flag with target-mysql.

The replace_null Option (Experimental)

By enabling the replace_null option, null values are replaced with 'empty' equivalents based on their data type. Use with caution as it may alter data semantics.

When replace_null is true, null values are replaced as follows:

JSON Schema Data Type Null Value Replacement
string Empty string("")
number 0
object Empty object({})
array Empty array([])
boolean false
null null

Usage

cat <input_stream> | target-mysql --config <config.json>
  • <input_stream>: Input data stream
  • <config.json>: JSON configuration file

target-mysql reads data from a Singer Tap and writes it to a MySQL database. Run Singer Tap to generate data before launching target-mysql.

Here's an example of using Singer Tap with target-mysql:

tap-exchangeratesapi | target-mysql --config config.json

In this case, tap-exchangeratesapi is a Singer Tap that generates exchange rate data. The data is passed to target-mysql through a pipe(|), and target-mysql writes it to a MySQL database. config.json contains target-mysql settings.

Developer Resources

Initializing the Development Environment

pipx install poetry
poetry install

Creating and Running Tests

Create tests in the macrometa_target_mysql/tests subfolder and run:

poetry run pytest

Use poetry run to test target-mysql CLI interface:

poetry run target-mysql --help

Testing with Meltano

Note: This target functions within a Singer environment and does not require Meltano.

Firstly, install Meltano and necessary plugins:

# Install Meltano
pipx install meltano

# Initialize Meltano in this directory
cd target-mysql
meltano install

Then, test and orchestrate with Meltano:

# Call tests:
meltano invoke target-mysql --version

# Or execute pipeline with Carbon Intensity sample tap:
meltano run tap-carbon-intensity target-mysql

SDK Development Guide

For in-depth instructions on crafting Singer Taps and Targets using Meltano Singer SDK, see the Development Guide.

Reference Links

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

macrometa-target-mysql-0.0.2.tar.gz (105.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macrometa_target_mysql-0.0.2-py3-none-any.whl (118.6 kB view details)

Uploaded Python 3

File details

Details for the file macrometa-target-mysql-0.0.2.tar.gz.

File metadata

  • Download URL: macrometa-target-mysql-0.0.2.tar.gz
  • Upload date:
  • Size: 105.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for macrometa-target-mysql-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a6b27ca75006a65b1e0c57ea03c262879d64de1e8e17773d97db671f31b895da
MD5 366144aee6d32d83d55c1d414f6580ed
BLAKE2b-256 75e43a6afcf9e7840cd5ebe2a13ebf4336a73b606961b6c5da2a209e2c290aca

See more details on using hashes here.

File details

Details for the file macrometa_target_mysql-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for macrometa_target_mysql-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f17c7b975ab476638ea0fffa87a17f8a1624be3b16afefac00dee37dffb563a1
MD5 1da5472505bc1c37c78cc60dc9d39e0b
BLAKE2b-256 92cd25614585fe332c4a74fa55305db384049ba45b04e00fb0bf79de148c1e1c

See more details on using hashes here.

Supported by

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