Using Mutations
The connector will automatically scan for available mutations. Given that there is no method provided by GraphQL for determining which mutations can be used for each table, each mutation is exposed as a stored procedure. This replaces the traditional use of INSERT, UPDATE, and DELETE SQL statements when working with GraphQL.
All SCALAR mutation fields are exposed directly, and all object fields are expanded.
LIST fields are exposed as temporary tables (GraphQL tables of type TEMPORARY_TABLE). The discovered temporary tables can be obtained by querying the sys_tables and sys_tablecolumns system tables. These tables contain a RowId and ParentId field to denote the row and housing (parent) table of a given child table.
An example of a mutation is productCreate. Invoke mutations as a stored procedure after first loading the relevant child tables needed for the operation:
INSERT INTO productCreate_metafields#TEMP (namespace,key,value,type) VALUES ('MRproductInfo','ALU','449788022','string') INSERT INTO productCreate_variants#TEMP (RowId,price,sku,inventoryManagement,weightUnit,weight,options,metafields,inventoryQuantities) VALUES (1,'39.99','38536314-0acb-4d3f-b8ff-a0f2014d2c75','SHOPIFY','POUNDS',1,'L,XL,XXL','productCreate_variants_metafields','productCreate_variants_inventoryQuantities') INSERT INTO productCreate_variants_metafields#TEMP (ParentId,namespace,key,value,type) VALUES ('1','MRproductInfo','ALU','449788022-M-','string') INSERT INTO productCreate_variants_metafields#TEMP (ParentId,namespace,key,value,type) VALUES ('1','MRproductInfo','ItemNumber','400000881201','string') INSERT INTO productCreate_variants_inventoryQuantities#TEMP (ParentId,locationId,availableQuantity) VALUES ('1','gid://shopify/Location/1448280087',5) INSERT INTO productCreate_media#TEMP (originalSource,alt,mediaContentType) VALUES ('https://static.nike.com/a/images/t_PDP_1280_v1/f_auto,q_auto:eco/qwqfyddzikcgc4ozwigp/revolution-5-road-running-shoes-szF7CS.png','Magic Shoes','IMAGE') EXECUTE productCreate title='NIKE - 449788022', descriptionHtml='MEN''S SHOES 42-MENS L/S TEES',productType='Staging', vendor='NIKE', published='false', options='size,width',metafields='productCreate_metafields#TEMP', variants='productCreate_variants#TEMP', media='productCreate_media#TEMP'