Ecommerce Shopify WordPress Discussion

How can I dynamically add Arguments to an Operation create by sqqlc-codegen

I am working on a python-tool that interacts with the Shopify GraphQL API. I started using the sqglc-libraby to have the convenience of handling everything with python objects instead of the long-winded dict-like accessing of Grapqhl queries and responses. Having followed the documentation on how to create types and operations (https://sgqlc.readthedocs.io/en/latest/sgqlc.codegen.html) i have created my own operations pytho module. However, im stuck on something that i thought the code-first approach would help me solve: The below query is stored in my_operations.gql and from it the corresponding code is created by the codegen tool. query BulkAllStock{ productVariants{ edges { cursor node { id barcode sku inventoryItem { inventoryLevel{ id available quantities(names: ["available", "on_hand", "committed"]) { name quantity } } } } } } } def query_bulk_all_stock(): _op = sgqlc.operation.Operation(_schema_root.query_type, name='BulkAllStock') _op_product_variants = _op.product_variants() _op_product_variants_edges = _op_product_variants.edges() _op_product_variants_edges.cursor() _op_product_variants_edges_node = _op_product_variants_edges.node() _op_product_variants_edges_node.id() _op_product_variants_edges_node.barcode() _op_product_variants_edges_node.sku() _op_product_variants_edges_node_inventory_item = _op_product_variants_edges_node.inventory_item() _op_product_variants_edges_node_inventory_item_inventory_level = _op_product_variants_edges_node_inventory_item.inventory_level() _op_product_variants_edges_node_inventory_item_inventory_level.id() _op_product_variants_edges_node_inventory_item_inventory_level.available() _op_product_variants_edges_node_inventory_item_inventory_level_quantities = _op_product_variants_edges_node_inventory_item_inventory_level.quantities(names=('available', 'on_hand', 'committed')) _op_product_variants_edges_node_inventory_item_inventory_level_quantities.name() _op_product_variants_edges_node_inventory_item_inventory_level_quantities.quantity() return _op I would now like to pass further arguments to this query to further narrow down the response data by adding a inventorlevelID to the inventoryLevel field like so: ... inventoryLevel(locationId: $location_id){ ... Reading the documentation I could not figure out how to do this with the Operation Object that i create from the generated code. It appears to me that i would need to inlcude another query with that arugment included, but that would mean a lot of repeated code. The background on this is the way that bulk queries in shopify work. These are another set of queries that take another query as a variable in form of a muti line string, this query cant include variables however as explained here: https://stackoverflow.com/questions/69354063/use-variables-in-shopify-bulk-operations-graphql-mutation So my idea was to first create the operation that is meant to be passed into the bulk-query including the variables i want to have, and then pass the pure grapqhl-string into a bulk query operation that i can simply execute with the sqglc endpoint. So how could I create an sgqlc operation object where i can add an argument to an arbitrary field if possible at all? I tried adding variables to the operation after instantiating the object, but that does not seem to work.
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.