Fluent Commerce Logo
Docs

Bulk Extracts with GraphQL

How-to Guide

Author:

Movyn John

Changed on:

20 Nov 2023

Key Points

  • A python script can be used for ad-hoc extracts of a large number of GQL entities into a CSV file. 
  • Currently the Fluent platform does not support any bulk extracts. 
  • This scripts helps to extract data in bulk using the pagination functionality provided by the schema.
  • Depending on the amount of data that is extracted the script might run for a while.
  • The above codes are provided as is and are for reference purposes. 

Steps

Step arrow right iconPre-Requisites

  • Python3 (brew install python3)
  • IDE (e.g. PyCharm)
  • Some developer/python experience

Step arrow right iconAfter setting up Python3 and a Python IDE import the python script below

Step arrow right iconExtract various positions

The script is ready to extract 3 different entity types and the corresponding sections need to be commented out/in (other entities can be added to the script):
  • InventoryPositions: lines 10-29 & 83-84
  • VariantProducts: lines 31-51 & 85-86
  • VirtualPositions: lines 54-75 & 87-88

Step arrow right iconresult

After executing successfully a csv file is produced, which will follow the filename pattern `yyyymmdd_{{acccountId}}_{{entityType}}.cs` e.g. `20191122_FLUENT_virtualPositions.csv`

Step arrow right iconBulk extract on Store Location Hours

another example code to extract Store Location Hours: