Urgent.News

What's breaking now, across hundreds of outlets.

Tech

109 Rows for 17 Products: What Happens to Nested JSON When You Load an API

When we walked our Shopify setup guide against a real store, the run finished and reported 109 rows . The store had 17 products and 3 customers . Nothing was duplicated and nothing went wrong. Those 109 rows are exactly what the store holds, spread across seven tables instead of two. Load any API that returns nested JSON and you will see a number like this on your first run. It is worth…

When a Shopify API is loaded, the resulting data is spread across seven tables rather than a single flat table. This happens because each product contains lists of variants, images, and options, which in turn contain their own lists. To store this nested structure, the loading library, dlt, creates separate tables for each list.

The resulting number of 109 rows comes from the sum of all these tables, excluding the bookkeeping tables dlt creates. For example, a store with 17 products and 3 customers has 109 rows: 17 products, 26 product variants, 18 product images, 17 product options, 17 option values, 3 customers, and 2 customer addresses.

The nested nature of the data is evident in the table names, which reflect their hierarchical structure. For instance, 'products__variants' represents the list of variants for each product. The double underscore separates the path to each list within a table.

The Rows figure for an upload is the sum of all the data written to the tables, not just the number of products. This figure is useful for confirming that data was moved during the load process, but it does not give the exact number of products. When reconciling data, it's better to check each table individually.

dlt adds additional columns to the nested tables to maintain the relationships between them. These columns include _dlt_id, which is a unique key for each row across all tables, _dlt_parent_id, which points to the parent row for a nested table, and _dlt_list_idx, which represents the position of an item in its original list.

After a successful upload, the nested tables are recognized as dbt sources, allowing for easy transformation and querying. The schema for these sources is derived from the upload name, with whitespace replaced by underscores and the entire string converted to lowercase.

To join nested tables in a transformation, you can use the _dlt_parent_id column to link each child table back to its parent. This approach works regardless of how the vendor structures the data, as dlt includes the necessary information for all nested tables.

In summary, when loading a nested API like Shopify, you can expect a number of tables that is greater than the number of top-level objects. Understanding the structure of these tables, including the _dlt_parent_id and _dlt_list_idx columns, is crucial for accurate reconciliation and transformation in downstream processes.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Before You Quote a Small Website, Count the Hours You Won't Spend Coding

A client asks for a small site. You estimate 16 hours of build time. At a target of $40 per hour, the fixed fee looks like $640.

  • $40 per hour rate targets $800 labor cost for 20-hour estimate
  • 20 hours include 16 for design/build, 1 for kickoff, 3 for revisions/handoff
  • Clearly communicate revision allowance to avoid scope misunderstandings

Our n8n workflow said "Active" for a day while doing nothing

One of our client workflows said "Active" for most of a day while it did nothing at all. The workflow is a 37-step n8n pipeline we built for CollageDepot, an online art store.

  • 37-step n8n workflow appeared "Active"
  • Workflow's IMAP trigger lost connection
  • Monitoring workflow output recommended

Zero-day hands attackers vCenter admin

CVE-2026-123890 is an unauthenticated authentication bypass in VMware vCenter's Directory Service, rated CVSS 9.8, and successful exploitation hands an attacker an authenticated session as…

  • Unauthenticated authentication bypass vulnerability in vCenter Directory Service
  • Armory Castle exploited zero-day in early September 2026
  • Attackers gained full admin control and exfiltrated data

How to compare VPS renewal prices with open data

The cheapest VPS on the pricing page can move down the list once you include renewals. A $3/month offer that renews at $8 after a 12-month term averages $5.50 over two years.

  • VPS renewal fees can increase true price over time
  • $3/month VPS may renew at $8 after a year
  • $5/month VPS with no renewal increase stays $5

More from Wednesday 25 November →