{"id":24733407,"url":"https://github.com/grll/saleor-gql-loader","last_synced_at":"2025-10-10T02:30:20.057Z","repository":{"id":40123980,"uuid":"259410926","full_name":"grll/saleor-gql-loader","owner":"grll","description":"a simple python wrapper around saleor graphql api to quickly load your data","archived":false,"fork":false,"pushed_at":"2022-06-25T15:50:09.000Z","size":21,"stargazers_count":40,"open_issues_count":3,"forks_count":23,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-22T04:46:55.213Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-27T17:59:30.000Z","updated_at":"2024-07-08T19:42:46.000Z","dependencies_parsed_at":"2022-06-26T14:22:51.676Z","dependency_job_id":null,"html_url":"https://github.com/grll/saleor-gql-loader","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fsaleor-gql-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fsaleor-gql-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fsaleor-gql-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grll%2Fsaleor-gql-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grll","download_url":"https://codeload.github.com/grll/saleor-gql-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235897829,"owners_count":19062691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-27T18:15:11.768Z","updated_at":"2025-10-10T02:30:14.750Z","avatar_url":"https://github.com/grll.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Saleor GraphQL Loader\n\n`saleor-gql-loader` is small python package that allows you to quickly and easily\ncreate entities such as categories, warehouses, products on your saleor website\nusing the graphQL endpoint exposed by saleor.\n\nAs of now, `saleor-gql-loader` allows to create the following entities:\n\n- [x] warehouse\n- [x] shipping_zone\n- [x] attribute\n- [x] attribute_value\n- [x] product_type\n- [x] category\n- [x] product\n- [x] product_variant\n- [x] product_image\n- [x] customers\n\nand update the following entities:\n\n- [x] shop\n- [x] private meta\n\nPR for supporting more graphQL mutations and/or queries are more than welcome.\n\nIn it's current state, the project is in very early alpha, might be unstable\nand no tests are provided.\n\n_disclaimer: This project is not connected nor it has been endorsed by saleor\nteam/community._\n\n## installation\n\nusing Pypi:\n\n```bash\npip install saleor-gql-loader\n```\n\nOr cloning the repo:\n\n```bash\ngit clone https://github.com/grll/saleor-gql-loader.git\n```\n\n## usage\n\n### prerequisities\n\nThe first requirement is to have a running saleor installation with the latest\nversion installed (2.10).\n\nBefore being able to use the package to create entities you need to create a\nsaleor app with the necessary permissions to create the entities you need.\n\nOne way of doing that is to use the specific django cli custom command `create_app`:\n\n```bash\npython manage.py create_app etl --permission account.manage_users \\\n                                --permission account.manage_staff \\\n                                --permission app.manage_apps \\\n                                --permission discount.manage_discounts \\\n                                --permission plugins.manage_plugins \\\n                                --permission giftcard.manage_gift_card \\\n                                --permission menu.manage_menus \\\n                                --permission order.manage_orders \\\n                                --permission page.manage_pages \\\n                                --permission product.manage_products \\\n                                --permission shipping.manage_shipping \\\n                                --permission site.manage_settings \\\n                                --permission site.manage_translations \\\n                                --permission webhook.manage_webhooks \\\n                                --permission checkout.manage_checkouts\n```\n\n\u003e This command will return a token. Keep it somewhere as it will be need to use the\n\u003e loader.\n\n### loading data\n\n`saleor-gql-loader` package exposes a single class that needs to be initialized\nwith the authentication token generated in the section above. Then for each entity\nthat you want to create there is a corresponding method on the class.\n\n```python\nfrom saleor_gql_loader import ETLDataLoader\n\n# initialize the data_loader (optionally provide an endpoint url as second parameter)\netl_data_loader = ETLDataLoader(\"LcLNVgUt8mu8yKJ0Wrh3nADnTT21uv\")\n\n# create a warehouse\nwarehouse_id = etl_data_loader.create_warehouse()\n```\n\nby default the `ETLDataLoader` will create a warehouse with sensible default values\nin order to not make the query fail. You can override any parameter from the graphQL\ntype corresponding to the input of the underlying mutation.\n\nFor example, to set the name and email of my warehouse:\n\n```python\n# create a warehouse with specified name and email\nwarehouse_id = etl_data_loader.create_warehouse(name=\"my warehouse name\", email=\"email@example.com\")\n```\n\nWhen a input field is mandatory it will need to be passed as first argument for example\nyou can't create an attribute_value without specifying on which attribute id:\n\n```python\n# create a year attribute\nyear_attribute_id = etl_data_loader.create_attribute(name=\"year\")\n\n# add the following year value to the year attribute\npossible_year_values = [2020, 2019, 2018, 2017]\nfor year in possible_year_values:\n    etl_data_loader.create_attribute_value(year_attribute_id, name=year)\n```\n\nThat's all there is to it. I added a jupyter notebook as an example with more usage [here](https://github.com/grll/saleor-gql-loader/blob/master/saleor_gql_loader/example.ipynb) where you will find a full\nexample that I used to populate my data.\n\nFor more details, I recommend you to check out the [code](https://github.com/grll/saleor-gql-loader/blob/master/saleor_gql_loader/data_loader.py), I tried to document it as much\nas possible (it's only one module with one class).\n\nonce again for any new features additions comments, feel free to open an issue or\neven better make a Pull Request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrll%2Fsaleor-gql-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrll%2Fsaleor-gql-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrll%2Fsaleor-gql-loader/lists"}