Skip to content

Commit 0c51020

Browse files
authored
Remove discontinued collection export method (#211)
1 parent 76ca077 commit 0c51020

File tree

3 files changed

+0
-134
lines changed

3 files changed

+0
-134
lines changed

arango/collection.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -623,67 +623,6 @@ def response_handler(resp: Response) -> Cursor:
623623

624624
return self._execute(request, response_handler)
625625

626-
def export(
627-
self,
628-
limit: Optional[int] = None,
629-
count: bool = False,
630-
batch_size: Optional[int] = None,
631-
flush: bool = False,
632-
flush_wait: Optional[int] = None,
633-
ttl: Optional[Number] = None,
634-
filter_fields: Optional[Sequence[str]] = None,
635-
filter_type: str = "include",
636-
) -> Result[Cursor]:
637-
"""Export all documents in the collection using a server cursor.
638-
639-
:param flush: If set to True, flush the write-ahead log prior to the
640-
export. If set to False, documents in the write-ahead log during
641-
the export are not included in the result.
642-
:type flush: bool
643-
:param flush_wait: Max wait time in seconds for write-ahead log flush.
644-
:type flush_wait: int | None
645-
:param count: Include the document count in the server cursor.
646-
:type count: bool
647-
:param batch_size: Max number of documents in the batch fetched by
648-
the cursor in one round trip.
649-
:type batch_size: int | None
650-
:param limit: Max number of documents fetched by the cursor.
651-
:type limit: int | None
652-
:param ttl: Time-to-live for the cursor on the server.
653-
:type ttl: int | float | None
654-
:param filter_fields: Document fields to filter with.
655-
:type filter_fields: [str] | None
656-
:param filter_type: Allowed values are "include" or "exclude".
657-
:type filter_type: str
658-
:return: Document cursor.
659-
:rtype: arango.cursor.Cursor
660-
:raise arango.exceptions.DocumentGetError: If export fails.
661-
"""
662-
data: Json = {"count": count, "flush": flush}
663-
if flush_wait is not None:
664-
data["flushWait"] = flush_wait
665-
if batch_size is not None:
666-
data["batchSize"] = batch_size
667-
if limit is not None:
668-
data["limit"] = limit
669-
if ttl is not None:
670-
data["ttl"] = ttl
671-
if filter_fields is not None:
672-
data["restrict"] = {"fields": filter_fields, "type": filter_type}
673-
request = Request(
674-
method="post",
675-
endpoint="/_api/export",
676-
params={"collection": self.name},
677-
data=data,
678-
)
679-
680-
def response_handler(resp: Response) -> Cursor:
681-
if not resp.is_success:
682-
raise DocumentGetError(resp, request)
683-
return Cursor(self._conn, resp.body, "export")
684-
685-
return self._execute(request, response_handler)
686-
687626
def find(
688627
self, filters: Json, skip: Optional[int] = None, limit: Optional[int] = None
689628
) -> Result[Cursor]:

docs/simple.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Here is an example of using ArangoDB's **simply queries**:
4848
Here are all simple query (and other utility) methods available:
4949

5050
* :func:`arango.collection.Collection.all`
51-
* :func:`arango.collection.Collection.export`
5251
* :func:`arango.collection.Collection.find`
5352
* :func:`arango.collection.Collection.find_near`
5453
* :func:`arango.collection.Collection.find_in_range`

tests/test_document.py

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import pytest
22

33
from arango.exceptions import (
4-
CursorCloseError,
5-
CursorNextError,
64
DocumentCountError,
75
DocumentDeleteError,
86
DocumentGetError,
@@ -1676,76 +1674,6 @@ def test_document_keys(col, bad_col, docs):
16761674
assert err.value.error_code in {11, 1228}
16771675

16781676

1679-
def test_document_export(col, bad_col, docs, cluster):
1680-
if cluster:
1681-
pytest.skip("Not tested in a cluster setup")
1682-
1683-
# Set up test documents
1684-
col.insert_many(docs)
1685-
1686-
# Test export with flush set to True and flush_wait set to 1
1687-
cursor = col.export(flush=True, flush_wait=1)
1688-
assert clean_doc(cursor) == docs
1689-
assert cursor.type == "export"
1690-
1691-
# Test export with count
1692-
cursor = col.export(flush=False, count=True)
1693-
assert cursor.count() == len(docs)
1694-
assert clean_doc(cursor) == docs
1695-
1696-
# Test export with batch size
1697-
cursor = col.export(flush=False, count=True, batch_size=1)
1698-
assert cursor.count() == len(docs)
1699-
assert clean_doc(cursor) == docs
1700-
1701-
# Test export with time-to-live
1702-
cursor = col.export(flush=False, count=True, ttl=10)
1703-
assert cursor.count() == len(docs)
1704-
assert clean_doc(cursor) == docs
1705-
1706-
# Test export with filters
1707-
cursor = col.export(
1708-
count=True, flush=False, filter_fields=["text"], filter_type="exclude"
1709-
)
1710-
assert cursor.count() == len(docs)
1711-
assert all(["text" not in d for d in cursor])
1712-
1713-
# Test export with a limit of 0
1714-
cursor = col.export(flush=False, count=True, limit=0)
1715-
assert cursor.count() == 0
1716-
assert clean_doc(cursor) == []
1717-
1718-
# Test export with a limit of 1
1719-
cursor = col.export(flush=False, count=True, limit=1)
1720-
assert cursor.count() == 1
1721-
assert len(list(cursor)) == 1
1722-
all([clean_doc(d) in docs for d in cursor])
1723-
1724-
# Test export with a limit of 3
1725-
cursor = col.export(flush=False, count=True, limit=3)
1726-
assert cursor.count() == 3
1727-
assert len(list(cursor)) == 3
1728-
all([clean_doc(d) in docs for d in cursor])
1729-
1730-
# Test export with bad database
1731-
with assert_raises(DocumentGetError):
1732-
bad_col.export()
1733-
1734-
# Test closing export cursor
1735-
cursor = col.export(flush=False, count=True, batch_size=1)
1736-
assert cursor.close(ignore_missing=False) is True
1737-
assert cursor.close(ignore_missing=True) is False
1738-
1739-
assert clean_doc(cursor.next()) in docs
1740-
with assert_raises(CursorNextError):
1741-
cursor.next()
1742-
with assert_raises(CursorCloseError):
1743-
cursor.close(ignore_missing=False)
1744-
1745-
cursor = col.export(flush=False, count=True)
1746-
assert cursor.close(ignore_missing=True) is None
1747-
1748-
17491677
def test_document_random(col, bad_col, docs):
17501678
# Set up test documents
17511679
col.import_bulk(docs)

0 commit comments

Comments
 (0)