def merge_database(**kwargs): config = update_config_date(**kwargs) database = '{}'.format(config['DATABASE']['TEMP_DATABASE']) defaults_file = config['DATABASE']['CONFIG_FILE'] sql_path = config["FILES"]['MERGE_SCHEMA_FILE'] try: subprocess_cmd('mysql --defaults-file=' + defaults_file + ' ' + database + ' < ' + sql_path) except: print('bash command failed')
def begin_post_processing(**kwargs): config = update_config_date(**kwargs) consolidate_rawlocation(config) consolidate_cpc(config) detail_desc_length(config) consolidate_uspc(config) pct_data_doc_type(config) consolidate_claim(config) consolidate_usreldoc(config) yearly_claim(config) yearly_brf_sum_text(config) yearly_draw_desc_text(config) yearly_detail_desc_text(config)
def drop_database(**kwargs): config = update_config_date(**kwargs) database = '{}'.format(config['DATABASE']['TEMP_DATABASE']) host = '{}'.format(config['DATABASE']['HOST']) user = '******'.format(config['DATABASE']['USERNAME']) password = '******'.format(config['DATABASE']['PASSWORD']) port = '{}'.format(config['DATABASE']['PORT']) engine = create_engine( 'mysql://{0}:{1}@{2}:{3}/{4}?charset=utf8mb4'.format( user, password, host, port, database)) engine.execute('DROP DATABASE {};'.format(database))
def create_database(**kwargs): config = update_config_date(**kwargs) database = '{}'.format(config['DATABASE']['TEMP_DATABASE']) host = '{}'.format(config['DATABASE']['HOST']) user = '******'.format(config['DATABASE']['USERNAME']) password = '******'.format(config['DATABASE']['PASSWORD']) defaults_file = config['DATABASE']['CONFIG_FILE'] conn = pymysql.connect(host=host, user=user, password=password) conn.cursor().execute('CREATE DATABASE {};'.format(database)) sql_path = config["FILES"]['APP_DB_SCHEMA_FILE'] try: subprocess_cmd('mysql --defaults-file=' + defaults_file + ' ' + database + ' < ' + sql_path) except: print('bash command failed')
def post_upload_database(**kwargs): config = update_config_date(**kwargs) qc = AppUploadTest(config) qc.runTests()
def post_merge_database(**kwargs): config = update_config_date(**kwargs) qc = AppMergeTest(config) qc.runTests()
def post_create_database(**kwargs): config = update_config_date(**kwargs) qc = RenameTest(config) qc.runTests()
def begin_parsing(**kwargs): config = update_config_date(**kwargs) download_xml_files(config) queue_parsers(config)