Skip to content
Back

Cannot load nested relationships

  • 0
  • Databases
  • Flutter
  • Cloud
rlee128
7 Sep, 2025, 03:58

When trying to load a nested relationship using the below query I get this error: Invalid query: Attribute not found in schema: *

TypeScript
try {
      final queries = <String>[
        Query.select(['*', 'accounts.*, accounts.owner_id.*']),
        Query.orderDesc('\$createdAt'),
        Query.limit(limit),
      ];

      if (cursor != null && cursor.isNotEmpty) {
        queries.add(Query.cursorAfter(cursor));
      }

      final response = await tableDBSignal.value!.listRows(
        databaseId: Constants.dbID,
        tableId: Constants.transactionsDB,
        queries: queries,
      );
      return response.rows.map((doc) => Transactions.fromMap(doc.data)).toList();
    } on AppwriteException catch (e) {
      log('Error fetching transactions: ${e.message}, ${e.code}');
      return [];
    }
TL;DR
Issue: Error message "Invalid query: Attribute not found in schema" when attempting to load nested relationships in a query. Solution: Ensure that the attributes referenced in the nested relationship query are correctly specified in the schema. Double-check that the attributes like 'accounts' and 'owner_id' are properly defined in the schema to avoid this error.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more