Teradata / PyTd

A Python Module to make it easy to script powerful interactions with Teradata Database in a DevOps friendly way.
MIT License
108 stars 43 forks source link

Provide API to access details of ignored errors. #42

Closed escheie closed 8 years ago

escheie commented 8 years ago

The ignoreErrors feature prevents expected errors from causing exceptions and from logging the traceback to the logs. It would be nice to be able to access the expected error when it occurs. Something like:

cursor = session.execute("""CREATE TABLE ${dbname}.checkpoints (
    appName VARCHAR(1024) CHARACTER SET UNICODE, 
    checkpointName VARCHAR(1024) CHARACTER SET UNICODE)
    UNIQUE PRIMARY INDEX(appName)""",
    ignoreErrors=[3803])
if cursor.error is not None:
    logger.info("Skipping table create as table already exists.")

Where cursor.error is the Error object containing the error code and message.