Skip to content

Teable record limit of 1000 could cause data loss or incomplete queries #6

@AdamEXu

Description

@AdamEXu

Problem

All Teable API queries use a hardcoded limit=1000 which means:

  • If we have more than 1000 users, some won't be returned
  • If we have more than 1000 admins, some won't be returned
  • If we have more than 1000 API keys, some won't be returned
  • Admin operations could accidentally skip users/admins

Affected Files

  • models/admin.py:24 - get_all_admins()
  • models/api_key.py:88 - get_all_api_keys()
  • models/user.py:67,129 - get_user_by_id(), get_all_users()
  • routes/admin.py:464 - Permission management

Risk

Medium - Will cause silent failures once we exceed 1000 records in any table

Recommendations

  1. Short-term: Add warning logs when we approach 1000 records
  2. Medium-term: Implement pagination in Teable queries
  3. Long-term: Consider if we need a different data store for large datasets

Example Fix

def get_all_users() -> List[Dict[str, Any]]:
    all_records = []
    offset = 0
    page_size = 1000
    
    while True:
        records = get_records('users', limit=page_size, offset=offset)
        if not records:
            break
        all_records.extend(records)
        if len(records) < page_size:
            break
        offset += page_size
    
    return all_records

Labels

bug, scalability, medium-priority

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestgood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions