A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Using 'first' argument in a bulk query i am trying to get 1000 customers out of 500000 and i'm getting all 500000 customers. Is there a reason for this?
How can i get different JSONL files each contains 1000 customers?
The reason for taking 1000 customers is that if 500000 customers are found in one file then the file size becomes bigger and it becomes difficult to read.
Here is my query:
mutation {
bulkOperationRunQuery(
query:"""
{
customers(first:1000) {
edges {
node {
id
firstName
lastName
email
}
}
}
}
"""
)
{
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
Shopify reference:
https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api#write-a-bulk-operation
https://shopify.dev/docs/admin-api/graphql/reference/bulk-operations/bulkoperation
Solved! Go to the solution
This is an accepted solution.
Try substituting created_at with customer_date and it works based on my testing. Also mentioned here --> https://community.shopify.com/c/Shopify-APIs-SDKs/Graphql-query-for-customers-with-date-filter-not-f...
Hope this helps!
Hey @RavindraPatel
In the documentation you linked, I wanted to point out it mentions that first is ignored:
The first argument is optional and ignored if present, so it can be removed.
If you want to reduce the sample size, I would suggest filtering on something else, perhaps created_at?
Kevin_A | Solutions Engineer @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hey @Kevin_A
For bulk customer query the 'created_at' filter does not work. It returns all customers..
It works for products and orders.
This is an accepted solution.
Try substituting created_at with customer_date and it works based on my testing. Also mentioned here --> https://community.shopify.com/c/Shopify-APIs-SDKs/Graphql-query-for-customers-with-date-filter-not-f...
Hope this helps!
Thank you guys.
Can someone help how to retrieve line items only using Bulk graphql ,
Below query is showing the error ('userErrors : ', [{u'field': [u'query'], u'message': u"The parent 'node' field for a nested connection must select the 'id' field. Connection fields without 'id': orders."}]). Please advise whether we can retrieve only line items using bulk graphql ?
mutation {
bulkOperationRunQuery(query: """
{
orders {
edges {
node {
lineItems {
edges {
node {
id
}
}
}
}
}
}
}
""") {
bulkOperation {
id
status
}
userErrors {
field
message
}
}
}
If you re-read the thread above, I believe the way that GQL operates requires at least an id field be present for any edges.node scenario. Personally I would rather have a little "too much" data, as compared to not enough. It's easier to discard any fields that you don't want than make additional calls or jump through another hoop if you need other fields, right?