Created
December 15, 2011 22:47
-
-
Save neilkod/1483313 to your computer and use it in GitHub Desktop.
super-hacky script to get the good stuff out of a teradata fastload log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat parse_fastload_log.py | |
import re | |
logfile="/var/opt/sports_dw/dev/td_sports/td_sports_log/pt_email_dim.log" | |
values = {} | |
items = ['Total Records Read', | |
'Total Error Table 1', | |
'Total Error Table 2', | |
'Total Inserts Applied', | |
'Total Duplicate Rows'] | |
with open(logfile) as f: | |
data = f.readlines() | |
total_records_read = 0 | |
for line in data: | |
if line.find('insert into') > 0: | |
table_name = line.split()[3] | |
for item in items: | |
if line.find(item) >0: | |
values[item] = re.findall('[0-9]{1,}', line)[-1] | |
print "Table Name: %s" % table_name | |
print " " | |
for k,v in values.iteritems(): | |
print "%s: %s" % (k,v) | |
-bash-3.1$ python parse_fastload_log.py | |
Table Name: sports_writer_dev.pt_email_dim_t | |
Total Inserts Applied: 39665245 | |
Total Duplicate Rows: 0 | |
Total Error Table 1: 0 | |
Total Records Read: 39665245 | |
Total Error Table 2: 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment