(self, curs, data, table = None)
Copy data to table. If table not provided, use temp table.
        When re-using existing temp table, it is always truncated first and
        analyzed after copy.
Copy data to table. If table not provided, use temp table.
        When re-using existing temp table, it is always truncated first and
        analyzed after copy.
Copy data to table . If table not provided use temp table . When re - using existing temp table it is always truncated first and analyzed after copy .
def bulk_insert(self, curs, data, table = None):
        """Copy data to table. If table not provided, use temp table.
        When re-using existing temp table, it is always truncated first and
        analyzed after copy.
        """
        if not data:
            return
        _use_temp = table is None
        # if table not specified use temp
        if _use_temp:
            table = self.temp
            # truncate when re-using existing table
            if not self.create_temp(curs):
                self.truncate(curs)
        self.log.debug("bulk: COPY %d rows into %s", len(data), table)
        skytools.magic_insert(curs, table, data, self.fields,
                              quoted_table = True)
        if _use_temp and self.run_analyze:
            self.analyze(curs)
def bulk_insert ( self , curs , data , table = None ) : if not data : return _use_temp = table is None # if table not specified use temp if _use_temp : table = self . temp # truncate when re-using existing table if not self . create_temp ( curs ) : self . truncate ( curs ) self . log . debug ( "bulk: COPY %d rows into %s" , len ( data ) , table ) skytools . magic_insert ( curs , table , data , self . fields , quoted_table = True ) if _use_temp and self . run_analyze : self . analyze ( curs )