Beispiel #1
0
def insert_statements(file_path):
    """Get insert statements from given file"""
    with wpi_utils.open_compressed(file_path) as dump_file:
        if fnmatch.fnmatch(os.path.basename(file_path), '*categorylinks*'):
            statements = categorylinks_pipeline(dump_file)
        else:
            statements = generic_pipeline(dump_file)

        for stmt in statements:
            yield stmt
Beispiel #2
0
def test_categorylink_pipeline():
    for file_path in wpi_utils.find('*categorylinks*.sql.gz', DOWNLOAD_DIR):
        with wpi_utils.open_compressed(file_path) as cl_file:
            eq_(list(wpi_psql.categorylinks_pipeline(cl_file)),
                EXPECTED_STMTS['categorylinks'])