src/utils/qa/countRows.csh 1.8
1.8 2009/09/10 22:30:55 kuhn
simplified to remove extra processing, including dependence on writing files. fixed so actual rowcount is printed, instead of message that dev and beta agree
Index: src/utils/qa/countRows.csh
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/utils/qa/countRows.csh,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -B -U 4 -r1.7 -r1.8
--- src/utils/qa/countRows.csh 8 Jun 2009 22:55:36 -0000 1.7
+++ src/utils/qa/countRows.csh 10 Sep 2009 22:30:55 -0000 1.8
@@ -8,82 +8,42 @@
################################
set db=""
set tablelist=""
-set argFlag=0
-set all=""
-set outname=""
+set tables=""
-if ($#argv < 2) then
+if ($#argv != 2) then
echo
echo " gets the rowcount for a list of tables from dev and beta."
echo
- echo " usage: database tablelist [verbose]"
+ echo " usage: database tablelist"
echo " tablelist can be just name of single table"
- echo " verbose reports rowcounts even if dev = beta"
echo
exit
else
set db=$argv[1]
set tablelist=$argv[2] # file of tablenames or single table name
- if ($#argv > 2) then
- set all=$argv[3]
- endif
endif
-# echo "database: $db"
+echo "database $db"
+echo "tablelist $tablelist"
echo
-if (-e $tablelist) then
+if ( -e $tablelist ) then
echo "running countRows for tables:"
- cat $tablelist
+ set tables=`cat $tablelist`
+ echo "tables $tables"
echo
-endif
-
-# if $argv[2] was a track name, not a list of tables, make a file
-if (! -e $tablelist) then
- echo $argv[2] > xxtablelistxx
- set tablelist="xxtablelistxx"
- set outname=$argv[2]
else
- # strip dbname from tablelist name, if present
- set outname=`echo $tablelist | sed -e "s/$db\.//"`
+ set tables=$tablelist
endif
-# echo "outname = $outname"
-
-rm -f $db.$outname.rowcounts
-rm -f $db.$outname.badcounts
-foreach table (`cat $tablelist`)
+foreach table ( $tables )
set dev=`hgsql -N -e "SELECT COUNT(*) FROM $table" $db`
set beta=`hgsql -h $sqlbeta -N -e "SELECT COUNT(*) FROM $table" $db`
- if ($dev != $beta) then
- echo $table >> $db.$outname.badcounts
- echo $table >> $db.$outname.rowcounts
- echo "=============" >> $db.$outname.rowcounts
- echo "."$dev >> $db.$outname.rowcounts
- echo "."$beta >> $db.$outname.rowcounts
- echo >> $db.$outname.rowcounts
- else
- if ($all == "all") then
- # save info on equal counts, too
- echo $table >> $db.$outname.rowcounts
- echo "=============" >> $db.$outname.rowcounts
- echo "."$dev >> $db.$outname.rowcounts
- echo "."$beta >> $db.$outname.rowcounts
- echo >> $db.$outname.rowcounts
- endif
- endif
+ echo $table
+ echo "============="
+ echo "."$dev
+ echo "."$beta
+ echo
end
-# clean out file
-rm -f xxtablelistxx
-
-# show results
-if (-e $db.$outname.rowcounts) then
- # echo "dev first"
- echo
- cat $db.$outname.rowcounts
-else
- echo "all tables have same count of rows"
- echo
-endif