Skip to content

[FEATURE] Custom table name mapping when replicating multiple MySQL databases into a single ClickHouse database #205

@progshubham

Description

@progshubham

Hi, I’m using mysql_ch_replicator to replicate data from multiple MySQL databases (for example, statiq_dev, charge_mate, and evlink) into a single ClickHouse database (analytics_db).

My use case:

I want to replicate only selected databases and tables.

All data should go into one ClickHouse database (analytics_db).

I want to customize or prefix the table names based on the source database to avoid conflicts and improve readability.

For example:

MySQL → ClickHouse
statiq_dev.users     → analytics_db.statiq_users
statiq_dev.chargers  → analytics_db.statiq_chargers
charge_mate.users    → analytics_db.charge_mate_users
evlink.transactions  → analytics_db.evlink_transactions

The current configuration allows:

databases: to select DBs

tables: to include/exclude tables

target_databases: to map source DB → target DB

But there’s no option to rename or prefix tables when multiple source DBs map to the same target DB.

Could you please consider adding a new configuration option such as:


table_name_mapping:
  statiq_dev:
    users: statiq_users
    chargers: statiq_chargers
  charge_mate:
    users: charge_mate_users

Or even an automatic option like:
auto_prefix_table_names: true

that would replicate tables as <source_db>__<table_name> automatically.

This would make multi-database → single ClickHouse use cases much easier and cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions