def check(opts, spec, source_map) -> Tuple[couchbaseConstants.PUMP_ERROR, Any]: rv: couchbaseConstants.PUMP_ERROR = 0 if spec.endswith(".csv"): if spec.startswith(CSVSink.CSV_JSON_SCHEME): targetpath = spec[len(CSVSink.CSV_JSON_SCHEME):] else: targetpath = spec[len(CSVSink.CSV_SCHEME):] targetpath = os.path.normpath(targetpath) rv = pump.mkdirs(targetpath) return rv, None
def check(opts, spec, source_map): rv = 0 if spec.endswith(".csv"): if spec.startswith(CSVSink.CSV_JSON_SCHEME): targetpath = spec[len(CSVSink.CSV_JSON_SCHEME):] else: targetpath = spec[len(CSVSink.CSV_SCHEME):] targetpath = os.path.normpath(targetpath) rv = pump.mkdirs(targetpath) return rv, None
def write_index_file(sink_spec, source_bucket, index_defs, file_name): if index_defs: path = BFD.get_file_path(sink_spec, source_bucket['name'], file_name) try: rv = pump.mkdirs(path) if rv: return rv, None f = open(path, 'w') f.write(index_defs) f.close() except IOError, e: return ("error: could not write %s; exception: %s") % (path, e), None
def write_index_file(sink_spec: str, source_bucket: Dict[str, Any], index_defs: str, file_name: str): if index_defs: path = BFD.get_file_path(sink_spec, source_bucket['name'], file_name) try: rv = pump.mkdirs(path) if rv: return rv, None f = open(path, 'w') f.write(index_defs) f.close() except IOError as e: return f'error: could not write {path}; exception: {e}', None return 0
def consume_design(opts, sink_spec, sink_map, source_bucket, source_map, source_design): if source_design: fname = BFD.design_path(sink_spec, source_bucket['name']) try: rv = pump.mkdirs(fname) if rv: return rv, None f = open(fname, 'w') f.write(source_design) f.close() except IOError, e: return ("error: could not write design: %s" + "; exception: %s") % (fname, e), None