Skip to main content

Pagination

The OpenMetadata API uses cursor-based pagination for list endpoints. This ensures consistent results even when data changes between requests.

Pagination Parameters

ParameterTypeDefaultDescription
limitinteger10Number of results per page (max 1000)
beforestring-Cursor for previous page
afterstring-Cursor for next page

Response Fields

The paging object contains:
FieldTypeDescription
totalintegerTotal count of matching resources
beforestringCursor for the previous page (if available)
afterstringCursor for the next page (if available)

Examples

Basic Pagination

Basic Pagination
from metadata.sdk import Tables
from metadata.sdk.entities.tables import TableListParams

# Get first page
params = TableListParams.builder().limit(20).build()
first_page = Tables.list(params)

print(f"Total tables: {first_page.paging.total}")
for table in first_page.data:
    print(table.fullyQualifiedName)

# Get next page using after cursor
if first_page.paging.after:
    next_params = TableListParams.builder().limit(20).after(first_page.paging.after).build()
    next_page = Tables.list(next_params)
    for table in next_page.data:
        print(table.fullyQualifiedName)

Iterating Through All Results

Iterating Results
from metadata.sdk import Tables

# Auto-paginate through all tables
for table in Tables.list().auto_paging_iterable():
    print(table.fullyQualifiedName)
    # Process each table...

Filtering with Pagination

Combine pagination with filters for efficient data retrieval:
Filtering
from metadata.sdk import Tables
from metadata.sdk.entities.tables import TableListParams

# List tables from a specific database with fields
params = TableListParams.builder() \
    .limit(50) \
    .fields(["owners", "tags"]) \
    .build()
tables = Tables.list(params)

for table in tables.data:
    print(table.fullyQualifiedName)

Include Fields

Control which fields are returned in the response using the fields parameter:
# Request specific fields
curl -X GET "https://your-company.open-metadata.org/api/v1/tables?fields=owner,tags,columns&limit=20" \
  -H "Authorization: Bearer $TOKEN"
Common field options for tables:
  • owner - Include owner information
  • tags - Include tags and classifications
  • columns - Include column definitions
  • followers - Include followers
  • tableConstraints - Include constraints
  • usageSummary - Include usage statistics

Best Practices

1

Use reasonable page sizes

Start with limit=50-100. Larger pages reduce API calls but increase memory usage.
2

Don't skip pages

Always use cursors sequentially. Don’t try to construct cursor values manually.
3

Handle empty results

Check if data array is empty or after cursor is null to detect end of results.
4

Request only needed fields

Use the fields parameter to reduce response size and improve performance.
5

Implement retry logic

Handle transient errors gracefully when paginating through large datasets.
For finding specific resources, consider using the Search API instead of paginating through all results:
# Search is faster for finding specific resources
curl -X GET "https://your-company.open-metadata.org/api/v1/search/query?q=customers&index=table_search_index" \
  -H "Authorization: Bearer $TOKEN"

Search API

Learn about searching and filtering metadata