Пример #1
0
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')
Пример #2
0
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)
Пример #3
0
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))
Пример #4
0
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')
Пример #5
0
def post_upload_database(**kwargs):
    config = update_config_date(**kwargs)
    qc = AppUploadTest(config)
    qc.runTests()
Пример #6
0
def post_merge_database(**kwargs):
    config = update_config_date(**kwargs)
    qc = AppMergeTest(config)
    qc.runTests()
Пример #7
0
def post_create_database(**kwargs):
    config = update_config_date(**kwargs)
    qc = RenameTest(config)
    qc.runTests()
Пример #8
0
def begin_parsing(**kwargs):
    config = update_config_date(**kwargs)
    download_xml_files(config)
    queue_parsers(config)