Skip to main content

A simple table mapping tool for the command line to be used with AWS DMS

Project description

Badges

Test and coverage

Table of Contents

DMS - Table mapping generator

This is a tool to generate table mapping files for the DMS (Data Migration Service)

Pre-requisites:

  • Python 3.6
  • A .txt file with the tables

e.g. tables.txt:

table1
table2
table3

Usage

Type tdms -h to see the help:

tdms -h

usage: tdms [-h] -t TABLE_LIST_INPUT -s SCHEMA_LIST_INPUT [-p PREFIX_VALUE] -r RULE_ACTION -y TABLE_TYPES

Create a table mapping json file for DMS

options:
  -h, --help            show this help message and exit
  -t TABLE_LIST_INPUT,  --table_list_input TABLE_LIST_INPUT
                        The file that contains the list of tables to be mapped
  -s SCHEMA_LIST_INPUT, --schema_list_input SCHEMA_LIST_INPUT
                        The schema that the tables are in
  -p PREFIX_VALUE,      --prefix_value PREFIX_VALUE
                        The prefix value to be added to the table names
  -r RULE_ACTION,       --rule_action RULE_ACTION
                        The rule action to be used
  -y TABLE_TYPES,       --table_types TABLE_TYPES
                        The table types to be used

Example

tdms -t tables.txt -s public -p myprefix_ -r include -y view

Output example:

Values used: 

Table List Input     Schema List Input    Prefix Value         Rule Action          Table Types         
--------------------------------------------------------------------------------------------------------
tables.txt           public               myprefix_            include              view                
                                                                                                        
Prefix rule added-> myprefix_ in front of -> table1
Prefix rule added-> myprefix_ in front of -> table2
Prefix rule added-> myprefix_ in front of -> table3

Table mapping file generated:

{
  "rules": [
    {
      "rule-type": "transformation",
      "rule-id": "85",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "rule-target": "table",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table1"
      },
      "rule-action": "add-prefix",
      "value": "myprefix_"
    },
    {
      "rule-type": "selection",
      "rule-id": "85",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table1"
      },
      "rule-action": "include",
      "filters": []
    },
    {
      "rule-type": "transformation",
      "rule-id": "925",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "rule-target": "table",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table2"
      },
      "rule-action": "add-prefix",
      "value": "myprefix_"
    },
    {
      "rule-type": "selection",
      "rule-id": "925",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table2"
      },
      "rule-action": "include",
      "filters": []
    },
    {
      "rule-type": "transformation",
      "rule-id": "609",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "rule-target": "table",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table3"
      },
      "rule-action": "add-prefix",
      "value": "myprefix_"
    },
    {
      "rule-type": "selection",
      "rule-id": "609",
      "rule-name": "fc7099f456104bef9e0f9b2f811b63ba",
      "object-locator": {
        "schema-name": "public",
        "table-name": "table3"
      },
      "rule-action": "include",
      "filters": []
    }
  ]
}

Options

Option Description Example Required
-t The file that contains the list of tables to be mapped tables.txt Yes
-s The schema that the tables are in public Yes
-p The prefix value to be added to the table names myprefix_ No
-r The rule action to be used include Yes
-y The table types to be used view Yes

Test

To run the tests, in the root of the project, run:

make test

Coverage

To run the coverage, in the root of the project, run:

make coverage

License

This project is licensed under the MIT License - see the LICENSE file for details

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

tdms-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

tdms-0.1.0-py2.py3-none-any.whl (5.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tdms-0.1.0.tar.gz.

File metadata

  • Download URL: tdms-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure

File hashes

Hashes for tdms-0.1.0.tar.gz
Algorithm Hash digest
SHA256 224884d39fd79ed35e84db6f5b0fefd1dbf2cba6affd22ca22a79d245fcb86a2
MD5 d4b3439dd0f281844b066beed8518da8
BLAKE2b-256 13dbb13f2bfd492a795a39d62a700d58695eba0554db6321a50b4b4d6f406c0f

See more details on using hashes here.

File details

Details for the file tdms-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: tdms-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure

File hashes

Hashes for tdms-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b0559ad740ae03094df623f6a4c7d01c88c9899f869759cc1a35d491e77ef754
MD5 8c3557cf43a9127f1fb1bf9cfcd57142
BLAKE2b-256 b5f368f802c7e10e7928bb3be1bf20145fc064d469a1bbaa83a7d6575289bf90

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