import vertica_python

TEST_QUERY="SELECT * FROM log_parts_backup LIMIT 5";

conn_info = {'host': 'dev-wavert01.bodc.att.com',
             'port': 5433,
             'user': 'ng2157',
             'password': 'DEV-ng2157',
             'database': 'DEV_EDM',
             # 10 minutes timeout on queries
             'read_timeout': 600,
             # default throw error on invalid UTF-8 results
             'unicode_error': 'strict',
             # SSL is disabled by default
             'ssl': False,
             'connection_timeout': 5}

# simple connection, with manual close
#connection = vertica_python.connect(**conn_info)

# using with for auto connection closing after usage
with vertica_python.connect(**conn_info) as connection:
    # do things
    print("Connected to {} on host{} ".format(conn_info['database'],conn_info['host']))
    cur = connection.cursor()
    cur.execute(TEST_QUERY)
    for row in cur.iterate():
       print("The row is {}".format(row))


