Skip to content

Migrate Shopify Streams from REST API to GraphQL API - #201

Merged
sgandhi1311 merged 21 commits into
masterfrom
TDL-26979-gql-query-schema-update
Mar 28, 2025
Merged

sgandhi1311 merged 21 commits into
masterfrom
TDL-26979-gql-query-schema-update

Conversation

@sgandhi1311

@sgandhi1311 sgandhi1311 commented Feb 25, 2025 •

Copy link
Copy Markdown
Member

Description of change

This PR migrates several streams in tap-shopify from the REST API to the GraphQL API, improving performance and efficiency. Additionally, some stream changes were made to better align with Shopify’s data structure.

Changes & Updates

Migrated Streams (REST → GraphQL)

  • abandoned_checkouts
  • customers
  • orders
  • order_refunds
  • transactions
  • locations
  • inventory_levels
  • events
  • collections

Metafields Stream Refactoring

Removed: metafields (generic metafields stream)
Introduced New Streams:

  • metafields_products
  • metafields_collections
  • metafields_customers
  • metafields_orders

Collections Stream Refactoring

Removed: collects and custom_collections
Introduced New Stream: collections (consolidated collection stream)

QA steps

  • automated tests passing
  • manual qa steps passing (list below)

Risks

Rollback steps

  • revert this branch

AI generated code

https://internal.qlik.dev/general/ways-of-working/code-reviews/#guidelines-for-ai-generated-code

  • this PR has been written with the help of GitHub Copilot or another generative AI tool

@sgandhi1311 sgandhi1311 changed the title add new queries Schema Changes for REST API to GraphQL API Migration Mar 11, 2025
@sgandhi1311
sgandhi1311 marked this pull request as ready for review March 11, 2025 04:54
@sgandhi1311
sgandhi1311 force-pushed the TDL-26979-gql-query-schema-update branch from 4be5461 to fc706be Compare March 19, 2025 10:41
@sgandhi1311
sgandhi1311 force-pushed the TDL-26979-gql-query-schema-update branch from fc706be to 71619f3 Compare March 19, 2025 10:42
sgandhi1311 and others added 4 commits March 21, 2025 08:39
* graphql implementataion for custoemrs, events and locations stream

* Use graphql endpoint for orders

* add the queries in the respective stream class

* Update the logic for inventory levels stream

* Optimize inventory levels logic

* update transactions and order_refunds logic

* Initial commit for abandoned checkouts and collections streams

* Remove reference for the collects and custom collections

* optimize the order_refunds and transactions stream logic

* partial logic for collections

* update locations query

* add collections streams changes and separate out metafields as individual streams

* remove gql query file

* remove gql query file reference and include the query in the code

* fix abandoned checkouts logic

* format the code

* remove metafields reference from init file

* update checkout schema

* fix typo

* set the default page size to 250

* make pylint happy and format the code

* upgrade python packages

* fix circleci pylint issues

* modify variable name in collections stream

* optimize get query params method

* move the graphql base code to the base file

* removed reference to the gql_base file

* fix the pylint

* optimize the source code

* update unit test cases

* update exception in unit test

* Refactor the code -
1. Use the single query for inventiry levels to fetch the child object as well.
2. Add Sortkey in the products query
3. Update query names for the respective metafields

* move date_window_size to the parent class

* make pylint happy

* make pylint happy

* Make metafields related stream, order_refunds and transactions stream as pseudo incremental

* make pylint happy

* the similar scencario is tested in the integration test, so we can skip this test.

* Update Integration Tests for GraphQL Migration (#205)

* make initial base file changes

* add individual meta streams

* update all fields integration test

* update locations replication key in test suite

* remove old references of the stream

* avoid testing on the events stream

* reduce the default page size for metafields

* update state file in the bookmarks

* include events in the expected streams

* fix interrupt sync

* update foreign key for transactions table
@sgandhi1311 sgandhi1311 changed the title Schema Changes for REST API to GraphQL API Migration Migrate Shopify Streams from REST API to GraphQL API Mar 28, 2025
@sgandhi1311
sgandhi1311 merged commit abf5ddc into master Mar 28, 2025
@EricSeastrand

Copy link
Copy Markdown

Hey guys - StitchData customer here. It looks like the GraphQL rewrite omitted the order_items array within Orders (no way to see which products were in the order).
The schema also changed in a huge way: Everything switched from underscore to camel-case, then in BigQuery all the column names are lowercase (makes them unreadable). Needless to say, it's not backwards-compatible with the old schema.

These two issues have broken our reporting pipelines and made us unable to really use StitchData for our usecase.

Is this GraphQL rewrite still a work-in-progress? Feels like a lot was missed here and StitchData won't let us roll back or use the old version. At the very least, the new GraphQL-based API call should have all the same data.

Should I submit a GitHub issue for this, or is it something we need to ask StitchData support about?
Thanks!

@RushiT0122
RushiT0122 deleted the TDL-26979-gql-query-schema-update branch April 14, 2025 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants