All Questions
Tagged with dataloader graphql
61 questions
0
votes
0
answers
25
views
GraphQL filtering on nested object retrieved from database (using Dataloaders?)
I have an SQL Database that I access via EntityFramework (C#). I want to expose the objects via a GraphQL API using the Hot Choclate framework. They are to be exposed pretty much without any changes.
...
0
votes
0
answers
258
views
Why does async code mess up my dataloader in a graphql resolver?
I have a dataloader that I'm using to batch requests to a service to get my user's addresses.
The loader doesn't batch requests correctly when the parent resolver uses async code.
Here's a general ...
0
votes
1
answer
124
views
GraphQL Dataloader on non-id fields?
We're using NodeJS (typescript) and GraphQL for our backend.
Therefore we rely heavily on dataloaders, and we get more and more field resolvers that needs to be resolved on something other than IDs.
...
0
votes
2
answers
240
views
How to do counts in batch for graphql data loader?
I'm implementing a Graphql resolver for complex datatype. I try to use a data loader to avoid N+1 problem. I have a datatype with a counter. Therefore, in one graphql query I need to perform user ...
0
votes
2
answers
179
views
Confusion in initialising GraphQL Dataloader in context
context: ({ req }) => { if (req) { return { ip: headers.userip, headers, userLanguage, decodedToken, dataLoaders: { seoDataLoader: createSeoDataLoader() } } } }
Here I create a createSeoDataLoader ...
3
votes
1
answer
897
views
HotChocolate v.13 [UseProjections] attribute does not work with DataLoaders
I have the following GrapqhQL query:
query {
listTenants {
totalCount
items {
tenantId
name
sites {
totalCount
items {
siteId
cmxName
...
1
vote
1
answer
964
views
HotChocolate v.13 DataLoader approach with attributes and source generated code not working
I recently started experimenting with HotChocolate v.13. and I am having issues implementing the data loaders with the [DataLoader] attributes like shown in this video: Let's simplify DataLoader with ...
1
vote
0
answers
91
views
Why do you inject batch functions into context when you implement dataloader?
There are often examples of injecting the batch function into the context when implementing dataloader in Golang, but I'm not sure why.
While I understand the concept of caching data per request in ...
0
votes
1
answer
943
views
What is the best approach to use filter on GraphQL queries?
I am trying to understand what is the best approach to utilize query with filters in GraphQL for my scenario.
So far what I have learned is, GraphQL does not have filter concept. UI/Consumer can fetch ...
1
vote
0
answers
280
views
How to enable Redis cache and Loaders using Nest and Mercurius
I'm using Nest and Mercurius to create a GraphQL API. So far I was able to create queries and resolvers, but now I want to enable Loaders and Cache to improve performance. The documentation is not ...
1
vote
0
answers
306
views
How can I achieve graphql/dataloader like behaviour in AppSync?
I am currently building an AppSync API and after doing some research into how to load four different fields with two data sources (two fields per data source) I came across this question.
The response ...
0
votes
1
answer
545
views
GraphQL Query taking in multiple lists as arguments
This is about adding GraphQL to an existing Java api which takes in multiple lists as input.
Background:
I have an existing Java based REST API getFooInformationByRecognizer which takes in a list of ...
0
votes
1
answer
98
views
GraphQL pagination partial response with error array
I have a query like below
query {
heroes {
node {
name
}
endCursor
}
}
I am trying to understand how GraphQL can handle the error handling and return ...
1
vote
1
answer
402
views
Apollo Server Express v4 GraphQL this.findOneById is not a function
I have the following ApolloServer (v4)
import { MongoDataSource } from 'apollo-datasource-mongodb'
export default class LoaderAsset extends MongoDataSource {
async getAsset(assetId) {
return ...
1
vote
0
answers
519
views
dotnet hotchocolate. if I use Projection do I need to use DataLoader?
UserType:
[Node(IdField = nameof(Id))]
public class UserType
{
public Guid Id { get; set; }
public string Email { get; set; } = string.Empty;
public Company? Company { get; set; }
[...
1
vote
2
answers
1k
views
Nest.JS graphql subscription does not work with DataLoader (context is not defined)
I have a nestjs graphql application which uses DataLoader. It works fine for queries and mutations, but it does not work for subscriptions. This is how configuration is defined in app.module:
@Module({...
1
vote
0
answers
291
views
GraphQL DGS- Kotlin, Modify the parent resultSet, based on Child dataloader results
class UserEntity(val id: UUID, val name: String, val email: String){
val occupation: String? =null
}
class AddressEntity(val id:UUID){
val line1: String,
val line2 : String,
val city: City,
...
1
vote
0
answers
701
views
How to use dataloader loadMany function properly?
I am trying to use dataloader's loadMany function. But I am getting error. I already search many where but not getting any solutions. Please help me.
Here is my try-
loader.js (Here I write Loader ...
1
vote
0
answers
972
views
GraphQL + SpringBoot + DataLoaders: what is the right pattern?
I have GraphQL + SpringBoot + MongoDB application, with graphql.java.kickstart.springboot ,and I'm having performance issues.
The walking skeleton of this application was done the last year and I ...
4
votes
1
answer
2k
views
Graphql nested cursor based pagination, resolver and SQL query
Is there a way to implement graphql cursor based pagination with nested pagination queries in a performant way?
Let's say we have 3 pseudo graphql types:
type User {
id: ID!
books: [Book!]!
}
...
1
vote
1
answer
1k
views
GraphQL Dataloader fails if backend returns null values
I have a GraphQL object type Student. And each student may or may not have Phone data.
Phone is another GraphQL type object (A child object in Student).
I have GraphQL dataloader registered on Phone. ...
1
vote
0
answers
521
views
Typescript + GraphQL Dataloader more strict types using generics or overloads
I'm using GraphQL's dataloader and I'd like to make my return types more strict based on the keys that are passed in. How could I accomplish this? Feeble attempt below. I know why it doesn't work, but ...
3
votes
0
answers
1k
views
GraphQL DataLoader with multiple one to many relations
I'm struggling with a good title for this issue, so apologies. For that.
What I'm trying to achieve;
I have 3 Entities in use for this dataloader
User
Club
Player
Each User can create a Club
User ...
0
votes
1
answer
876
views
How to use Data Loader when parent contain IDs array?
I am trying to implementing data-loader in my project-
Here is my code-
subCategory: async (parent, _, {loaders}) => {
console.log(parent);
// I try it but getting errors
const ...
2
votes
0
answers
366
views
SQL pagination issues, and specifically with GraphQL data-loading
I've been doing some research on how to set up a new GraphQL API project, but am running into some basic conceptual? problems in trying to find out how to do pagination and nested database queries ...
0
votes
1
answer
1k
views
graphql dataloader Cannot read property 'load' of undefined error
I would like to bring the location data that exists below the location_group table. You are trying to use DataLoader because n + 1 problem exists.
I thought it was done, but when I actually run the ...
1
vote
1
answer
2k
views
GraphQL: several field resolver
everyone!
Has anyone met such case in graphql: you need resolve several fields with several async sources like this?
type Entity {
# ---- dataSource1
fieldA: String
fieldB: String
# ---- ...
0
votes
1
answer
552
views
Java DataLoader: Graphql query mismatches results
I am using boot-graphql-kick-start in my project. When I used Dataloader, the result is missmatching. where am I wrong? Can you help me?
Query:
query USE_ROLES_BY_PROJECT_ID($projectId: Int) { # ...
1
vote
0
answers
716
views
URQL GraphQL cache problem with relational data from dataloader
I'm implementing cursor pagination to create an infinite scroll of posts, building upon URQL's simple pagination example from the docs. It works fine, I get the posts I want with all the information I ...
1
vote
1
answer
926
views
Problem with DataLoader GraphQL returning wrong data
I developed an API using node with GraphQL, when I add the DataLoaders, the resolvers starts returning wrong data, like I pass 4 Ids [3, 3, 1, 2], the batch function find in Database and return ...
5
votes
1
answer
2k
views
How can I get Absinthe and Dataloader to work together?
I have a GraphQL API that works just fine using conventional resolve functions. My goal is to eliminate the N+1 problem.
To do so I've decided to use the Dataloader. I've done these steps to ...
1
vote
1
answer
1k
views
Using a dataloader on TypeORMs many-to-many relation with GraphQL, query many-to-many
I started using TypeORM + type-graphql and trying to implement different use cases.
A Queue has a many-to-many relationship with User.
My problem is that I want to retrieve a list of users given a ...
4
votes
3
answers
4k
views
How lazy should a GraphQL resolver be?
How lazy should a GraphQL resolver be?
For some context, here's a birds-eye of my architecture: GraphQL -> Resolvers -> |Domain Boundary| -> Services -> Loaders -> Data Sources (...
7
votes
1
answer
5k
views
Apollo Server: How to access 'context' outside of resolvers in Dataloader from REST API Datasource
hopefully someone can help me with this little problem, I just cannot figure it out right now.
Problem Statement:
I want to access 'context' for the sake of authentication in my DataLoader. This ...
1
vote
1
answer
502
views
Using pg-promise Tasks with graphql and dataloader
First thing is to say that I have seen this question Sharing a pg-promise task across parts of an http request and read the answer. I'd like to revisit the question with some added complication.
I am ...
5
votes
1
answer
5k
views
How to use DataLoader for Connections with Hot Chocolate GraphQL
I see that it's possible to use Data Loaders for root queries, but is it also possible to use Data Loaders for nested connections? In the example below, I want use a Data Loader for the rooms ...
10
votes
1
answer
7k
views
Best way to handle one-to-many with type-graphql typeorm and dataloader
I'm trying to figure out the best way to handle a one-to-many relationship using type-graphql and typeorm with a postgresql db (using apollo server with express). I have a user table which has a one-...
0
votes
1
answer
619
views
Apollo GraphQL DataLoader DynamoDb
I'm new to GraphQL and am reading about N+1 issue and the dataloader pattern to increase performance. I'm looking at starting a new GraphQL project with DynamoDB for the database. I've done some ...
1
vote
1
answer
268
views
Efficiently resolving belongs_to relationship in elixir dataloader?
Is it possible to use elixir dataloader to query a belongs_to relationship efficiently? It seems that the load is querying all of the items it needs, but the get is returning the first value of the ...
2
votes
1
answer
1k
views
Implementing In-memory cache alongside GraphQL Dataloaders
I'm looking into adding in-memory cache, like redis, to my application, and I'm having some issues understanding how it all fits together.
const postLoader = new DataLoader(async keys => {
// .....
2
votes
1
answer
1k
views
In Apollo GraphQL how to access Datasources inside Dataloader?
I'm new to GraphQL and I started using Apollo GraphQL. To test this basically I'm wrapping the GraphQL around Star Wars API (SWAPI.dev). I'm using Apollo RESTDataSource to make calls to Star Wars API.
...
1
vote
1
answer
758
views
How to deal with readonly arguments from DataLoader - (GraphQL + Apollo in NextJS)
I have a loader function in order to fetch chefs from a database. So that loader receive an array of ids and what's is strange is that the ids have a readonly type.
When I try to pass that read-only ...
5
votes
2
answers
3k
views
Type error initializing DataLoader with Typescript
I'm trying to initialize an instance of DataLoader using the following code:
const authorLoader = new DataLoader(async (keys:string[]) => {
// Return an author for each book
});
I'm getting ...
1
vote
2
answers
2k
views
How to use dataloader?
Im trying to figure this out.
I want to get all my users from my database, cache them
and then when making a new request I want to get those that Ive cached + new ones that have been created.
So ...
2
votes
2
answers
3k
views
Can I use data loader without batching
What I am really interested in with data-loader is the per request caching. For example say my graphql query needs to call getUser("id1") 3x. I would like something to dedupe that call.
However it ...
2
votes
0
answers
429
views
Message: Could not resolve promise in GraphQL api with DataLoader
I have created a basic api using graphical with PHP and mysql. when i have fire query using postman .
i am new grapql
{"query": "query { getPeople{name,pet{isDog,sound}} }" } then error come
but ...
1
vote
1
answer
491
views
graphql sequlize dataloader issue, Cannot return null for non-nullable field [duplicate]
schema for ip address:
import { gql } from 'apollo-server-express';
module.exports = gql`
extend type Query {
# allTxn: [SubscrTxn]
cblockIp(ip_key: Int!): CblockIp
}
...
5
votes
1
answer
2k
views
How to improve performance on nested graphql connections when using pagination
I'm trying to implement some kind of a basic social network project. It has Posts, Comments and Likes like any other.
A post can have many comments
A post can have many likes
A post can have one ...
0
votes
1
answer
374
views
Show specific columns with dataloader-sequelize in nested tables
Currently I have some models. I'm using graphql with dataloader-sequelize and it works fine as long as I show associated tables without third level.
My models:
"articulo.js"
'use strict';
module....
2
votes
0
answers
1k
views
How to achieve a one to many relationship with GraphQL & DataLoader
I'm having a hard time figuring out why my graphQL & DataLoader setup isn't working and could use some help.
I have a User and a Orchestra type, and I would like to transform a User to populate ...