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 .
Checkout the List Rows section in these docs: https://appwrite.io/docs/products/databases/rows
The latest TablesDB supports fetching multiple records
Can Someone for reference provide a repo as the docs do not provide the correct syntax
Well, I don't have a repo. But you can refer this -
tablesListRows(
databaseId: "<DATABASE_ID>",
tableId: "<TABLE_ID>",
queries: ["equal(\"<COLUMN_NAME>\", \"<VALUE>\")"]
) {
total
rows {
$id
genre
}
}
}
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
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
}
}
}
The error was coming from this part "equal("book_title", ["gaaa"])" which should be written like this: "equal(\"book_title\", [\"gaaa\"])"
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
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
}}
}}
}}
"""
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'
Can you please add an underscore before your column name? And share the outputs?
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'
query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal(book_title, gaaa)"] ) { total rows { _id data book_title } } }
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}]
Hey! Please write it like this. Sorry I missed the backslashes in my previous reply. Here's the actual one:
book_query = f"""
query {{
tablesDBListRows(
databaseId: "{DATABASE_ID}",
tableId: "{BOOK_COLLECTION_ID}",
queries: ["equal(\"book_title\", \"gaaa\")"]
) {{
total
rows {{
_id
data
book_title
}}
}}
}}
"""
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.
book_query = f""" query {{ tablesDBListRows( databaseId: "{DATABASE_ID}", tableId: "{BOOK_COLLECTION_ID}", queries: ["equal("book_title", "gaaa")"] ) {{ total rows {{ _id data book_title }} }} }} """
<@462046107556511744>
Can you kindly provide a solution for filters in graph ql as the docs are not up to date
<@870607367597850624> kindly provide a solution for the graph ql queries
Recommended threads
- Graph Ql Filters Syntax error
query { tablesDBListRows( databaseId: "690b62ea0019a21bfd2c", tableId: "book", queries: ["equal("book_title", "gaa...
- Added Custom Domain - API requests with ...
I've added in a custom domain to Appwrite my domain itself is on cloudflare but has Appwrite name servers added and confirmed they work, I added the CAA in clou...
- Sites not working
When I deploy NextJS using Appwrite Sites don't work and the build error is related to the WordPress backend link. Is there a solution? Thank you.