Public Repository

Last pushed: 2 years ago
Short Description
An image has Teradata ODBC well configured and data analyze python package installed.
Full Description

teradata_unixodbc

Docker Image with Teradata unixODBC connection ability.

Details refer to teradata_unixodbc

What this image contains?

  • Teradata ODBC Driver well configured
  • Python 2.7.5
  • Python data analyze packages numpy, pandas and matplotlib installed
  • Python teradata module installed
  • R 3.2.3 installed
  • OS version: CentOS Linux release 7.2.1511
  • Add tpt python module for loading data [tag=0.21]
  • Install tbuild, bteq, fastload Teradata client tools [tag=0.21]

Quick Start

If you're familiar with Docker, have it configured, and know exactly what you'd like to run, this one-liner should work in most cases:

# The following command will start a container which mapping your current work directory to /data in the container and return you an interactive shell
docker run -it  -v ${PWD}:/data:rw zhlh/teradata_unixodbc bash

Getting Started

If this is your first time using Docker or any of the images in this git repository, do the following to get started.

  1. Install Docker on your host of choice
  2. Open The README in one of the folders in this git repository
  3. Follow the README for the stack

Build your own image with the Dockerfile

cd teradata_unixodbc
docker build -t your-own-image-name[:tag] .

Get the image from Docker Hub

docker pull zhlh/teradata_unixodbc

Code demo on Teradata Connection

Teradata ODBC is well configured in this image, the following code demos how to use python teradata module to connect to Teradata through ODBC.

import teradata 

udaExec = teradata.UdaExec (appName="MyApp", version="1.0", logConsole=True)
conn = udaExec.connect(method="odbc", system="td_host_addr",username="td_username", password="td_password");

for row in conn.execute("SELECT GetQueryBand()"):
    print(row)

How to get an interactive python or bash shell??

Get an interactive python shell

docker run -it -v ${PWD}:/batchOps:rw zhlh/teradata_unixodbc python

Get an interactive bash shell

docker run -it -v ${PWD}:/batchOps:rw zhlh/teradata_unixodbc bash

Get an interactive R shell

docker run -it -v ${PWD}:/batchOps:rw zhlh/teradata_unixodbc  R

Tips

Run any command or script with the image.

docker run -v ${PWD}:/batchOps:rw zhlh/teradata_unixodbc cmd

If you think the docker command is too long, make it simple!
Use the run.py in the current directory.

${PWD}/run.py your-comand-with-aruguments


# Example
# list all disk usage information in the container
${PWD}/run.py /bin/df -h

# Output
jbmuser@lxc-docker-7200:~/docker-stacks/teradata_unixodbc$ ${PWD}/run.py /bin/df -h
[run.py:25 -             run() - INFO ] Run OS commamd: docker run  --rm            -v $(pwd):/batchOps:rw            -v /tmp:/tmp:rw            zhlh/teradata_unixodbc            /bin/df -h > /tmp/run_20160304Mar03.log 2>&1
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Filesystem                                              Size  Used Avail Use% Mounted on
none                                                     60G   49G  8.0G  86% /
tmpfs                                                   5.9G     0  5.9G   0% /dev
tmpfs                                                   5.9G     0  5.9G   0% /sys/fs/cgroup
/dev/disk/by-uuid/21813bed-571e-4fcc-905d-32bc13641493   60G   49G  8.0G  86% /tmp
shm                                                      64M     0   64M   0% /dev/shm

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[run.py:32 -             run() - INFO ] cmd return code: 0, command output store in file /tmp/run_20160304Mar03.log

Bugs or Suggestions

Maintainer: Zhang Lihui

Any bugs or suggestions is welcomed.

Docker Pull Command
Owner
zhlh