def copy(self, cursor, f):
        """
        Defines copying from s3 into redshift.

        If both key-based and role-based credentials are provided, role-based will be used.
        """
        logger.info("Inserting file: %s", f)
        colnames = ''
        if self.columns and len(self.columns) > 0:
            colnames = ",".join([x[0] for x in self.columns])
            colnames = '({})'.format(colnames)

        cursor.execute("""
         COPY {table} {colnames} from '{source}'
         CREDENTIALS '{creds}'
         {options}
         ;""".format(
            table=self.table,
            colnames=colnames,
            source=f,
            creds=self._credentials(),
            options=self.copy_options)
        )
def copy ( self , cursor , f ) : logger . info ( "Inserting file: %s" , f ) colnames = '' if self . columns and len ( self . columns ) > 0 : colnames = "," . join ( [ x [ 0 ] for x in self . columns ] ) colnames = '({})' . format ( colnames ) cursor . execute ( """
         COPY {table} {colnames} from '{source}'
         CREDENTIALS '{creds}'
         {options}
         ;""" . format ( table = self . table , colnames = colnames , source = f , creds = self . _credentials ( ) , options = self . copy_options ) )
Defines copying from s3 into redshift.

        If both key-based and role-based credentials are provided, role-based will be used.