Skip to content
Back

GRAPH QL Filters

  • 0
  • 5
  • GraphQL
Sait
13 Nov, 2025, 12:12

Hey Team The GraphQL API in Appwrite currently only supports single document fetches (databasesGetDocument) properly. So trying to pass databasesListDocuments with filters in GraphQL will always throw Invalid query method. Is there any work around for this .

TL;DR
Check the documentation on List Rows for the correct syntax. Issues faced due to incorrect syntax. Follow guidance to use backslashes in queries for filtering. Remove square brackets in the query. Add an underscore before the column name. Queries should have backslashes and double quotes. Ensure correct type in the queries. Update the syntax per the given examples.
13 Nov, 2025, 15:18

Checkout the List Rows section in these docs: https://appwrite.io/docs/products/databases/rows

13 Nov, 2025, 15:19

The latest TablesDB supports fetching multiple records

14 Nov, 2025, 09:13

Can Someone for reference provide a repo as the docs do not provide the correct syntax

14 Nov, 2025, 09:35

Well, I don't have a repo. But you can refer this -

TypeScript
  tablesListRows(
    databaseId: "<DATABASE_ID>",
    tableId: "<TABLE_ID>",
    queries: ["equal(\"<COLUMN_NAME>\", \"<VALUE>\")"]
  ) {
    total
    rows {
      $id
      genre
    }
  }
}
14 Nov, 2025, 09:57

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(book_title, [gaaa])"] ) { total rows { _id data } } }

Book Response: {'errors': [{'message': 'Invalid query: Syntax error', 'extensions': {'category': 'appwrite'}, 'locations': [{'line': 3, 'column': 13}], 'path': ['tablesDBListRows'], 'trace': [{'file': '/usr/src/code/src/Appwrite/GraphQL/Resolvers.php', 'line': 56, 'call': 'AppwriteGraphQLResolvers::resolve(instance of UtopiaApp, instance of AppwriteUtopiaRequest, instance of AppwriteUtopiaResponse, instance of Closure, instance of Closure)'}, {'file': '/usr/src/code/src/Appwrite/Promises/Swoole.php', 'line': 21, 'call': 'AppwriteGraphQLResolvers::AppwriteGraphQL{closure}(instance of Closure, instance of Closure)'}, {'call': 'AppwritePromisesSwoole::AppwritePromises{closure}()'}]}], 'data': {'tablesDBListRows': None}} No book found with the given title.

book_query = f""" query {{ tablesListRows( databaseId: "{DATABASE_ID}", tableId: "{BOOK_COLLECTION_ID}", queries: ["equal(book_title, [gaaa])"] ) {{ total rows {{ _id data }} }} }} """

Book Response: {'errors': [{'message': 'Cannot query field "tablesListRows" on type "Query". Did you mean "tablesDBListRows", "tablesDBGetRow", "tablesDBListRowLogs", "databasesListLogs", or "sitesListLogs"?', 'extensions': {'category': 'graphql'}, 'locations': [{'line': 3, 'column': 13}]}]}

If You see I tried the syntax which was sent by you but I am facing two different problems with different syntax

14 Nov, 2025, 10:02

Hey! You are still writing it incorrectly. You should write it like this - query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(\"book_title\", [\"gaaa\"])"] ) { total rows { _id data } } }

14 Nov, 2025, 10:03

The error was coming from this part "equal("book_title", ["gaaa"])" which should be written like this: "equal(\"book_title\", [\"gaaa\"])"

14 Nov, 2025, 10:07

book_query = f""" query {{ tablesDBListRows( databaseId: "{DATABASE_ID}", tableId: "{BOOK_COLLECTION_ID}", queries: ["equal("book_title", ["gaaa"])"] ) {{ total rows {{ _id data }} }} }} """

Book Response: {'errors': [{'message': 'Invalid query: Syntax error', 'extensions': {'category': 'appwrite'}, 'locations': [{'line': 3, 'column': 13}], 'path': ['tablesDBListRows'], 'trace': [{'file': '/usr/src/code/src/Appwrite/GraphQL/Resolvers.php', 'line': 56, 'call': 'AppwriteGraphQLResolvers::resolve(instance of UtopiaApp, instance of AppwriteUtopiaRequest, instance of AppwriteUtopiaResponse, instance of Closure, instance of Closure)'}, {'file': '/usr/src/code/src/Appwrite/Promises/Swoole.php', 'line': 21, 'call': 'AppwriteGraphQLResolvers::AppwriteGraphQL{closure}(instance of Closure, instance of Closure)'}, {'call': 'AppwritePromisesSwoole::AppwritePromises{closure}()'}]}], 'data': {'tablesDBListRows': None}} Error fetching book: 'NoneType' object has no attribute 'get'

Still running into error

14 Nov, 2025, 10:10

Ok. Try removing the square braces: book_query = f""" query {{ tablesDBListRows( databaseId: "{DATABASE_ID}", tableId: "{BOOK_COLLECTION_ID}", queries: ["equal(\\"book_title\\", \\"gaaa\\")"] ) {{ total rows {{ _id data }} }} }} """

14 Nov, 2025, 10:13

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal("book_title", "gaaa")"] ) { total rows { _id data } } }

127.0.0.1 - - [14/Nov/2025 11:12:41] "POST /graphql HTTP/1.1" 200 - Book Response: {'errors': [{'message': 'Invalid query: Syntax error', 'extensions': {'category': 'appwrite'}, 'locations': [{'line': 3, 'column': 13}], 'path': ['tablesDBListRows'], 'trace': [{'file': '/usr/src/code/src/Appwrite/GraphQL/Resolvers.php', 'line': 56, 'call': 'AppwriteGraphQLResolvers::resolve(instance of UtopiaApp, instance of AppwriteUtopiaRequest, instance of AppwriteUtopiaResponse, instance of Closure, instance of Closure)'}, {'file': '/usr/src/code/src/Appwrite/Promises/Swoole.php', 'line': 21, 'call': 'AppwriteGraphQLResolvers::AppwriteGraphQL{closure}(instance of Closure, instance of Closure)'}, {'call': 'AppwritePromisesSwoole::AppwritePromises{closure}()'}]}], 'data': {'tablesDBListRows': None}} Error fetching book: 'NoneType' object has no attribute 'get'

14 Nov, 2025, 10:16

Can you please add an underscore before your column name? And share the outputs?

14 Nov, 2025, 10:19

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(_book_title, gaaa)"] ) { total rows { _id data } } }

127.0.0.1 - - [14/Nov/2025 11:18:10] "POST /graphql HTTP/1.1" 200 - Book Response: {'errors': [{'message': 'Invalid query: Syntax error', 'extensions': {'category': 'appwrite'}, 'locations': [{'line': 3, 'column': 13}], 'path': ['tablesDBListRows'], 'trace': [{'file': '/usr/src/code/src/Appwrite/GraphQL/Resolvers.php', 'line': 56, 'call': 'AppwriteGraphQLResolvers::resolve(instance of UtopiaApp, instance of AppwriteUtopiaRequest, instance of AppwriteUtopiaResponse, instance of Closure, instance of Closure)'}, {'file': '/usr/src/code/src/Appwrite/Promises/Swoole.php', 'line': 21, 'call': 'AppwriteGraphQLResolvers::AppwriteGraphQL{closure}(instance of Closure, instance of Closure)'}, {'call': 'AppwritePromisesSwoole::AppwritePromises{closure}()'}]}], 'data': {'tablesDBListRows': None}} Error fetching book: 'NoneType' object has no attribute 'get'

14 Nov, 2025, 10:21

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(book_title, gaaa)"] ) { total rows { _id data book_title } } }

14 Nov, 2025, 10:26

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal("book_title", "gaaa")"] ) { total rows { _id data book_title } } }

Book Response: {'errors': [{'message': 'Field "tablesDBListRows" argument "queries" requires type String, found book_title.', 'extensions': {'category': 'graphql'}, 'locations': [{'line': 6, 'column': 34}]

14 Nov, 2025, 11:07

Hey! Please write it like this. Sorry I missed the backslashes in my previous reply. Here's the actual one:

TypeScript
book_query = f"""
query {{
  tablesDBListRows(
    databaseId: "{DATABASE_ID}",
    tableId: "{BOOK_COLLECTION_ID}",
    queries: ["equal(\"book_title\", \"gaaa\")"]
  ) {{
    total
    rows {{
      _id
      data
      book_title
    }}
  }}
}}
"""
14 Nov, 2025, 11:24

query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(book_title, gaaa)"] ) { total rows { _id data book_title } } }

127.0.0.1 - - [14/Nov/2025 12:22:15] "POST /graphql HTTP/1.1" 200 - Book Response: {'errors': [{'message': 'Cannot query field "book_title" on type "Row".', 'extensions': {'category': 'graphql'}, 'locations': [{'line': 12, 'column': 15}]}]} No book found with the given title.

14 Nov, 2025, 11:25

book_query = f""" query {{ tablesDBListRows( databaseId: "{DATABASE_ID}", tableId: "{BOOK_COLLECTION_ID}", queries: ["equal("book_title", "gaaa")"] ) {{ total rows {{ _id data book_title }} }} }} """

14 Nov, 2025, 11:56

<@462046107556511744>
Can you kindly provide a solution for filters in graph ql as the docs are not up to date

1
17 Nov, 2025, 11:21

<@870607367597850624> kindly provide a solution for the graph ql queries

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