Beispiel #1
0
    def create_temp_table(self, curs):
        if USE_REAL_TABLE:
            tempname = self.dest_table + "_loadertmpx"
        else:
            # create temp table for loading
            tempname = self.dest_table.replace('.', '_') + "_loadertmp"

        # check if exists
        if USE_REAL_TABLE:
            if skytools.exists_table(curs, tempname):
                self.log.debug("bulk: Using existing real table %s", tempname)
                return tempname, quote_fqident(tempname)

            # create non-temp table
            q = "create table %s (like %s)" % (quote_fqident(tempname),
                                               quote_fqident(self.dest_table))
            self.log.debug("bulk: Creating real table: %s", q)
            curs.execute(q)
            return tempname, quote_fqident(tempname)
        elif USE_LONGLIVED_TEMP_TABLES:
            if skytools.exists_temp_table(curs, tempname):
                self.log.debug("bulk: Using existing temp table %s", tempname)
                return tempname, quote_ident(tempname)

        # bizgres crashes on delete rows
        # removed arg = "on commit delete rows"
        arg = "on commit preserve rows"
        # create temp table for loading
        q = "create temp table %s (like %s) %s" % (
            quote_ident(tempname), quote_fqident(self.dest_table), arg)
        self.log.debug("bulk: Creating temp table: %s", q)
        curs.execute(q)
        return tempname, quote_ident(tempname)
Beispiel #2
0
    def create_temp_table(self, curs):
        if USE_REAL_TABLE:
            tempname = self.table_name + "_loadertmpx"
        else:
            # create temp table for loading
            tempname = self.table_name.replace('.', '_') + "_loadertmp"

        # check if exists
        if USE_REAL_TABLE:
            if skytools.exists_table(curs, tempname):
                self.log.debug("bulk: Using existing real table %s" % tempname)
                return tempname, quote_fqident(tempname)

            # create non-temp table
            q = "create table %s (like %s)" % (
                        quote_fqident(tempname),
                        quote_fqident(self.table_name))
            self.log.debug("bulk: Creating real table: %s" % q)
            curs.execute(q)
            return tempname, quote_fqident(tempname)
        elif USE_LONGLIVED_TEMP_TABLES:
            if skytools.exists_temp_table(curs, tempname):
                self.log.debug("bulk: Using existing temp table %s" % tempname)
                return tempname, quote_ident(tempname)

        # bizgres crashes on delete rows
        # removed arg = "on commit delete rows"
        arg = "on commit preserve rows"
        # create temp table for loading
        q = "create temp table %s (like %s) %s" % (
                quote_ident(tempname), quote_fqident(self.table_name), arg)
        self.log.debug("bulk: Creating temp table: %s" % q)
        curs.execute(q)
        return tempname, quote_ident(tempname)
Beispiel #3
0
 def create_temp(self, curs):
     self.temp_used = True
     # check if exists
     if USE_LONGLIVED_TEMP_TABLES:
         if skytools.exists_temp_table(curs, self.temp):
             self.log.debug("bulk: Using existing temp table %s" % self.temp)
             return
     self.create(curs)
Beispiel #4
0
 def create_temp(self, curs):
     self.temp_used = True
     # check if exists
     if USE_LONGLIVED_TEMP_TABLES:
         if skytools.exists_temp_table(curs, self.temp):
             self.log.debug("bulk: Using existing temp table %s" %
                            self.temp)
             return
     self.create(curs)
Beispiel #5
0
    def create_temp_table(self, curs):
        # create temp table for loading
        tempname = self.table_name.replace('.', '_') + "_loadertmp"

        # check if exists
        if USE_LONGLIVED_TEMP_TABLES:
            if skytools.exists_temp_table(curs, tempname):
                self.log.debug("Using existing temp table %s" % tempname)
                return tempname

        # bizgres crashes on delete rows
        arg = "on commit delete rows"
        arg = "on commit preserve rows"
        # create temp table for loading
        q = "create temp table %s (like %s) %s" % (
            quote_fqident(tempname), quote_fqident(self.table_name), arg)
        self.log.debug("Creating temp table: %s" % q)
        curs.execute(q)
        return tempname
Beispiel #6
0
    def create_temp_table(self, curs):
        # create temp table for loading
        tempname = self.table_name.replace('.', '_') + "_loadertmp"

        # check if exists
        if USE_LONGLIVED_TEMP_TABLES:
            if skytools.exists_temp_table(curs, tempname):
                self.log.debug("Using existing temp table %s", tempname)
                return tempname

        # bizgres crashes on delete rows
        arg = "on commit delete rows"
        arg = "on commit preserve rows"
        # create temp table for loading
        q = "create temp table %s (like %s) %s" % (
                quote_fqident(tempname), quote_fqident(self.table_name), arg)
        self.log.debug("Creating temp table: %s", q)
        curs.execute(q)
        return tempname
Beispiel #7
0
 def check_temp(self, curs):
     if USE_REAL_TABLE:
         self.temp_present = skytools.exists_table(curs, self.temp)
     else:
         self.temp_present = skytools.exists_temp_table(curs, self.temp)
Beispiel #8
0
 def check_temp(self, curs):
     self.temp_present = skytools.exists_temp_table(curs, self.temp)
Beispiel #9
0
 def check_temp(self, curs):
     if USE_REAL_TABLE:
         self.temp_present = skytools.exists_table(curs, self.temp)
     else:
         self.temp_present = skytools.exists_temp_table(curs, self.temp)