<s> """<STR_LIT>""" <EOL> import argparse <EOL> import pandas . io . sql as pdsql <EOL> from dataduct . data_access import redshift_connection <EOL> from dataduct . database import SqlScript <EOL> from dataduct . database import Table <EOL> from dataduct . qa import PrimaryKeyCheck <EOL> def primary_key_check ( ) : <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( '<STR_LIT>' , dest = '<STR_LIT>' , required = True ) <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> connection = redshift_connection ( ) <EOL> table = Table ( SqlScript ( args . table ) ) <EOL> result = pdsql . read_sql ( table . select_duplicates_script ( ) . sql ( ) , connection ) <EOL> check = PrimaryKeyCheck ( len ( result ) , name = args . test_name , <EOL> sns_topic_arn = args . sns_topic_arn ) <EOL> check . publish ( args . log_to_s3 , table = table . full_name , <EOL> path_suffix = args . path_suffix ) <EOL> connection . close ( ) </s>
