def get_output_as_csv(dataset, engines, db): """integrate datasets and return the output as a csv.""" wt.reload_scripts() eng = wt.join_postgres( dataset, database=testdb, database_name=testschema, host=pgdb_host, password=os_password, ) # Wait for 5 seconds time.sleep(5) csv_file = eng.to_csv() return csv_file
def set_weaver_data_packages(resources_up=True): """Setup or tear down pydataweaver test scripts Copy or delete pydataweaver test scripts from test_data directory, WEAVER_TEST_DATA_PACKAEGES_DIR to ~/.pydataweaver script directory WEAVER_SCRIPT_DIR """ if resources_up: if not WEAVER_SCRIPT_DIR: os.makedirs(WEAVER_SCRIPT_DIR) for file_name in WEAVER_TEST_DATA_PACKAGE_FILES: if resources_up: scr_pack_path = os.path.join(WEAVER_TEST_DATA_PACKAEGES_DIR, file_name + ".json") pack_path = os.path.normpath(scr_pack_path) shutil.copy(pack_path, WEAVER_SCRIPT_DIR) else: dest_pack_path = os.path.join(WEAVER_SCRIPT_DIR, file_name + ".json") dest_path = os.path.normpath(dest_pack_path) if os.path.exists(dest_path): os.remove(dest_path) wt.reload_scripts()