giraffez/export.py
def to_archive(self, writer):
        """
        Writes export archive files in the Giraffez archive format.
        This takes a `giraffez.io.Writer` and writes archive chunks to
        file until all rows for a given statement have been exhausted.

        .. code-block:: python

            with giraffez.BulkExport("database.table_name") as export:
                with giraffez.Writer("database.table_name.tar.gz", 'wb', use_gzip=True) as out:
                    for n in export.to_archive(out):
                        print("Rows: {}".format(n))

        :param `giraffez.io.Writer` writer: A writer handling the archive output

        :rtype: iterator (yields ``int``)
        """
        if 'b' not in writer.mode:
            raise GiraffeError("Archive writer must be in binary mode")
        writer.write(GIRAFFE_MAGIC)
        writer.write(self.columns.serialize())
        i = 0
        for n, chunk in enumerate(self._fetchall(ROW_ENCODING_RAW), 1):
            writer.write(chunk)
            yield TeradataEncoder.count(chunk)
def to_archive(self, writer):
        """
        Writes export archive files in the Giraffez archive format.
        This takes a `giraffez.io.Writer` and writes archive chunks to
        file until all rows for a given statement have been exhausted.

        .. code-block:: python

            with giraffez.BulkExport("database.table_name") as export:
                with giraffez.Writer("database.table_name.tar.gz", 'wb', use_gzip=True) as out:
                    for n in export.to_archive(out):
                        print("Rows: {}".format(n))

        :param `giraffez.io.Writer` writer: A writer handling the archive output

        :rtype: iterator (yields ``int``)
        """
        if 'b' not in writer.mode:
            raise GiraffeError("Archive writer must be in binary mode")
        writer.write(GIRAFFE_MAGIC)
        writer.write(self.columns.serialize())
        i = 0
        for n, chunk in enumerate(self._fetchall(ROW_ENCODING_RAW), 1):
            writer.write(chunk)
            yield TeradataEncoder.count(chunk)
Writes export archive files in the Giraffez archive format.
        This takes a `giraffez.io.Writer` and writes archive chunks to
        file until all rows for a given statement have been exhausted.

        .. code-block:: python

            with giraffez.BulkExport("database.table_name") as export:
                with giraffez.Writer("database.table_name.tar.gz", 'wb', use_gzip=True) as out:
                    for n in export.to_archive(out):
                        print("Rows: {}".format(n))

        :param `giraffez.io.Writer` writer: A writer handling the archive output

        :rtype: iterator (yields ``int``)