Skip to content
This repository has been archived by the owner on May 1, 2021. It is now read-only.
/ python-tdadapter Public archive

A Python extension library which allows to connect to Teradata RDBMS via CLIv2.

License

Notifications You must be signed in to change notification settings

chfly2000/python-tdadapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

tdcliviipy is a Python extension library which allows to connect to Teradata RDBMS via CLIv2 (Teradata native access interface).

Requirements

CLIv2 (32bit / 64bit)
C compiler

Installation

setup.py install build --compile=mingw32

Usage

from clivii import connect, CliFail

try:
    with connect("hostname/username,password") as con:
        print "Logon."

        stmt = "update db.table1 set col1 = 'value1' where col2 = 'value2';"

        print "Execute update:\n%s" % stmt
        count = con.update(stmt)
        print "Update record count: %d." % count

        count = 0
        stmt = "select * from dbc.tables where databasename='db1' and tablename = 'table1';"

        print "Execute query:\n%s" % stmt
        with con.query(stmt) as qry:
            print "(",
            for col in qry.cols:
                print unicode(col), ",",
            print ")"
            for row in qry:
                count += 1
                print "(",
                for fld in row:
                    print unicode(fld), ",",
                print ")"
        print "Query record count: %d." % count

        print "Logoff."
except CliFail as ex:
    print "%s" % ex

About

A Python extension library which allows to connect to Teradata RDBMS via CLIv2.

Resources

License

Stars

Watchers

Forks

Packages

No packages published