Using Python to create Teradata tables with random schema

mesmacosta

Marcelo Costa

Posted on January 3, 2020

Using Python to create Teradata tables with random schema

Having a large amount of test data sometimes take a lot of effort, and to simulate a more realistic scenario, it’s good to have a large number of tables with distinct column types. This script generates random tables schema for Teradata.

Environment

Activate your virtualenv
pip install --upgrade virtualenv
python3 -m virtualenv --python python3 env
source ./env/bin/activate
Install the requirements for the metadata generator
pip install -r requirements.txt

Code

Execution

export TERADATA_SERVER=127.0.0.1
export TERADATA_USERNAME=my_user
export TERADATA_PASSWORD=my_user_pwd
export TERADATA_DATABASE=my_db

python metadata_generator.py \
--teradata-host=$TERADATA_SERVER \
--teradata-user=$TERADATA_USERNAME \ 
--teradata-pass=$TERADATA_PASSWORD \
--teradata-database=$TERADATA_DATABASE

And that's it!

If you have difficulties, don’t hesitate reaching out. I would love to help you!

💖 💪 🙅 🚩
mesmacosta
Marcelo Costa

Posted on January 3, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related