The Exports resource provides methods to create, retrieve, and list data exports.
Methods
list
List all exports with pagination support.
client.exports.list(
limit=None,
cursor=None
) -> CursorPage[Export]
Maximum number of exports to return per page
Pagination cursor for fetching the next page of results
A paginated list of exports. Use .items to access the export list, .next_cursor for pagination, and .has_more to check if more results exist.
Example
from avala import Avala
client = Avala(api_key="your-api-key")
# List all exports
page = client.exports.list()
for export in page.items:
print(export.uid, export.status)
# List with pagination
page = client.exports.list(limit=20)
create
Create a new export for a project or dataset.
client.exports.create(
project=None,
dataset=None
) -> Export
UID of the project to export
UID of the dataset to export
The newly created export object. The export will be processed asynchronously.
You must specify either project or dataset (or both) when creating an export.
Example
# Export a project
export = client.exports.create(project="project-uid-123")
print(f"Export created: {export.uid}")
print(f"Status: {export.status}")
# Export a dataset
export = client.exports.create(dataset="dataset-uid-456")
# Export both
export = client.exports.create(
project="project-uid-123",
dataset="dataset-uid-456"
)
Export creation is an asynchronous operation. Use the get() method to poll the export status and retrieve the download URL when ready.
get
Retrieve a specific export by its UID.
client.exports.get(uid: str) -> Export
The unique identifier of the export
The export object containing uid, status, download_url, and timestamps.
Example
export = client.exports.get("export-uid-123")
if export.status == "completed":
print(f"Download URL: {export.download_url}")
elif export.status == "processing":
print("Export is still processing...")
elif export.status == "failed":
print("Export failed")
Async Usage
All methods are available in async form via client.async_exports:
import asyncio
from avala import AsyncAvala
async def main():
client = AsyncAvala(api_key="your-api-key")
# Create export
export = await client.exports.create(project="project-uid-123")
print(f"Export created: {export.uid}")
# Poll until complete
while export.status == "processing":
await asyncio.sleep(5)
export = await client.exports.get(export.uid)
if export.status == "completed":
print(f"Download: {export.download_url}")
asyncio.run(main())
Response Types
Export
Unique identifier for the export
Current status of the export (e.g., “pending”, “processing”, “completed”, “failed”)
URL to download the export file (available when status is “completed”)
Timestamp when the export was created
Timestamp when the export was last updated
CursorPage
List of items in the current page
Cursor for fetching the next page (None if no more pages)
Cursor for fetching the previous page
Property indicating if more results are available
Common Patterns
Polling for Export Completion
import time
# Create export
export = client.exports.create(project="project-uid-123")
# Poll until complete
while export.status in ["pending", "processing"]:
time.sleep(5)
export = client.exports.get(export.uid)
print(f"Status: {export.status}")
if export.status == "completed":
print(f"Download URL: {export.download_url}")
else:
print(f"Export failed with status: {export.status}")