Ejemplo n.º 1
0
    def loadInsertMany(self, dataList, procName, optionsD, workingDir):

        try:
            _ = workingDir
            ret = None
            sd = optionsD["sd"]
            skipD = optionsD["skip"]
            ioObj = IoAdapter(verbose=self.__verbose)
            logger.debug("%s pathlist %r", procName, dataList)
            with Connection(cfgOb=self.__cfgOb,
                            resourceName=self.__resourceName) as client:
                sdl = CockroachDbLoader(schemaDefObj=sd,
                                        ioObj=ioObj,
                                        dbCon=client,
                                        workPath=self.__workPath,
                                        cleanUp=False,
                                        warnings="default",
                                        verbose=self.__verbose)
                ret = sdl.load(inputPathList=dataList,
                               loadType="cockroach-insert-many",
                               deleteOpt="selected",
                               tableIdSkipD=skipD)
            # all or nothing here
            if ret:
                return dataList, dataList, []
            else:
                return [], [], []
        except Exception as e:
            logger.info("Failing with dataList %r", dataList)
            logger.exception("Failing with %s", str(e))

        return [], [], []
    def testLoadInsertBirdReference(self):

        try:

            sd, _, _, _ = self.__schP.getSchemaInfo("bird")
            if self.__createFlag:
                self.__schemaCreate(schemaDefObj=sd)
            inputPathList = self.__rpP.getLocatorObjList("bird")
            inputPathList.extend(self.__rpP.getLocatorObjList("bird_family"))
            with Connection(cfgOb=self.__cfgOb,
                            resourceName=self.__resourceName) as client:
                sdl = CockroachDbLoader(schemaDefObj=sd,
                                        ioObj=self.__ioObj,
                                        dbCon=client,
                                        workPath=self.__workPath,
                                        cleanUp=False,
                                        warnings="default",
                                        verbose=self.__verbose)
                ret = sdl.load(inputPathList=inputPathList,
                               loadType="cockroach-insert",
                               deleteOpt="selected")
                self.assertEqual(ret, True)
        except Exception as e:
            logger.exception("Failing with %s", str(e))
            self.fail()
Ejemplo n.º 3
0
 def testLoadInsertManyPdbxExampleFiles(self):
     try:
         sd, _, _, _ = self.__schP.getSchemaInfo("pdbx")
         if self.__createFlag:
             self.__schemaCreate(schemaDefObj=sd)
         inputPathList = self.__rpP.getLocatorObjList("pdbx")
         with Connection(cfgOb=self.__cfgOb, resourceName=self.__resourceName) as client:
             sdl = CockroachDbLoader(schemaDefObj=sd, ioObj=self.__ioObj, dbCon=client, workPath=self.__workPath, cleanUp=False, warnings="default", verbose=self.__verbose)
             ret = sdl.load(inputPathList=inputPathList, loadType="cockroach-insert-many", deleteOpt="selected", tableIdSkipD=self.__tableIdSkipD)
             self.assertEqual(ret, True)
     except Exception as e:
         logger.exception("Failing with %s", str(e))
         self.fail()