<s> """<STR_LIT>""" <EOL> import argparse <EOL> import pandas . io . sql as pdsql <EOL> from dataduct . data_access import redshift_connection <EOL> from dataduct . data_access import rds_connection <EOL> from dataduct . qa import CountCheck <EOL> def _get_source_data ( sql , hostname ) : <EOL> """<STR_LIT>""" <EOL> connection = rds_connection ( hostname ) <EOL> data = pdsql . read_sql ( sql , connection ) <EOL> connection . close ( ) <EOL> return data . iloc [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> def _get_destination_data ( sql ) : <EOL> """<STR_LIT>""" <EOL> connection = redshift_connection ( ) <EOL> data = pdsql . read_sql ( sql , connection ) <EOL> connection . close ( ) <EOL> return data . iloc [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> def count_check ( ) : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , required = True ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , required = True ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> required = True ) <EOL> parser . add_argument ( '<STR_LIT>' , type = float , dest = '<STR_LIT>' , <EOL> default = <NUM_LIT:1.0> ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , default = None ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , <EOL> default = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:store_true>' , default = False ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , default = None ) <EOL> args = parser . parse_args ( ) <EOL> source_count = _get_source_data ( args . source_sql , args . source_host ) <EOL> destination_count = _get_destination_data ( args . destination_sql ) <EOL> check = CountCheck ( source_count , destination_count , <EOL> name = args . test_name , <EOL> sns_topic_arn = args . sns_topic_arn , <EOL> tolerance = args . tolerance ) <EOL> check . publish ( args . log_to_s3 , dest_sql = args . destination_sql , <EOL> path_suffix = args . path_suffix ) </s>
