Example #1
0
    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
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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
Example #5
0
 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
Example #6
0
 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
Example #7
0
 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
Example #8
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
Example #9
0
 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
Example #10
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