''

def save(self, out, format):

    with Connection(self.dbinfo) as db:
        db.execute(self.query[format])
        features = []
        for row in db.fetchall():
            if (row['__geometry__'] is None):
                continue
            wkb = bytes(row['__geometry__'])
            prop = dict([(k, v) for (k, v) in row.items() if (k not in ('__geometry__', '__id__'))])
            if ('__id__' in row):
                features.append((wkb, prop, row['__id__']))
            else:
                features.append((wkb, prop))
    if (format == 'MVT'):
        mvt.encode(out, features)
    elif (format == 'JSON'):
        geojson.encode(out, features, self.zoom, self.clip)
    elif (format == 'TopoJSON'):
        ll = SphericalMercator().projLocation(Point(*self.bounds[0:2]))
        ur = SphericalMercator().projLocation(Point(*self.bounds[2:4]))
        topojson.encode(out, features, (ll.lon, ll.lat, ur.lon, ur.lat), self.clip)
    elif (format == 'PBF'):
        pbf.encode(out, features, self.coord, layer_name=self.layer_name)
    else:
        raise ValueError(format)
