Coverage for mindsdb / integrations / handlers / shopify_handler / models / product_variants.py: 0%
23 statements
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
« prev ^ index » next coverage.py v7.13.1, created at 2026-01-21 00:36 +0000
1from .common import (
2 AliasesEnum,
3 Count,
4 MoneyV2,
5)
6from .utils import Extract
9class ProductVariants(AliasesEnum):
10 """A class to represent a Shopify GraphQL product variant.
11 Reference: https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant
12 Require `read_products` permission.
13 """
15 availableForSale = "availableForSale"
16 barcode = "barcode"
17 compareAtPrice = "compareAtPrice"
18 # contextualPricing = "contextualPricing"
19 createdAt = "createdAt"
20 # defaultCursor = "defaultCursor"
21 # deliveryProfile = "deliveryProfile"
22 displayName = "displayName"
23 # events = "events"
24 id = "id"
25 # inventoryItem = "inventoryItem"
26 # inventoryPolicy = "inventoryPolicy"
27 inventoryQuantity = "inventoryQuantity"
28 # legacyResourceId = "legacyResourceId"
29 # media = "media"
30 # metafield = "metafield"
31 # metafields = "metafields"
32 position = "position"
33 price = "price"
34 # product = "product"
35 productId = Extract("product", "id") # Custom
36 # productParents = "productParents"
37 # productVariantComponents = "productVariantComponents"
38 requiresComponents = "requiresComponents"
39 # selectedOptions = "selectedOptions"
40 sellableOnlineQuantity = "sellableOnlineQuantity"
41 # sellingPlanGroups = "sellingPlanGroups"
42 sellingPlanGroupsCount = Count
43 showUnitPrice = "showUnitPrice"
44 sku = "sku"
45 taxable = "taxable"
46 title = "title"
47 # translations = "translations"
48 unitPrice = MoneyV2
49 # unitPriceMeasurement = "unitPriceMeasurement"
50 updatedAt = "updatedAt"
53columns = [
54 {
55 "TABLE_NAME": "product_variants",
56 "COLUMN_NAME": "availableForSale",
57 "DATA_TYPE": "BOOL",
58 "COLUMN_DESCRIPTION": "Whether the product variant is available for sale.",
59 "IS_NULLABLE": False,
60 },
61 {
62 "TABLE_NAME": "product_variants",
63 "COLUMN_NAME": "barcode",
64 "DATA_TYPE": "TEXT",
65 "COLUMN_DESCRIPTION": "The value of the barcode associated with the product.",
66 "IS_NULLABLE": None,
67 },
68 {
69 "TABLE_NAME": "product_variants",
70 "COLUMN_NAME": "compareAtPrice",
71 "DATA_TYPE": "JSON",
72 "COLUMN_DESCRIPTION": "The compare-at price of the variant in the default shop currency.",
73 "IS_NULLABLE": None,
74 },
75 # {
76 # "TABLE_NAME": "product_variants",
77 # "COLUMN_NAME": "contextualPricing",
78 # "DATA_TYPE": "JSON",
79 # "COLUMN_DESCRIPTION": "The pricing that applies for a customer in a given context. As of API version 2025-04, only active markets are considered in the price resolution.",
80 # "IS_NULLABLE": False
81 # },
82 {
83 "TABLE_NAME": "product_variants",
84 "COLUMN_NAME": "createdAt",
85 "DATA_TYPE": "TIMESTAMP",
86 "COLUMN_DESCRIPTION": "The date and time when the variant was created.",
87 "IS_NULLABLE": False,
88 },
89 # {
90 # "TABLE_NAME": "product_variants",
91 # "COLUMN_NAME": "defaultCursor",
92 # "DATA_TYPE": "TEXT",
93 # "COLUMN_DESCRIPTION": "A default cursor that returns the single next record, sorted ascending by ID.",
94 # "IS_NULLABLE": False
95 # },
96 # {
97 # "TABLE_NAME": "product_variants",
98 # "COLUMN_NAME": "deliveryProfile",
99 # "DATA_TYPE": "JSON",
100 # "COLUMN_DESCRIPTION": "The delivery profile for the variant.",
101 # "IS_NULLABLE": None
102 # },
103 {
104 "TABLE_NAME": "product_variants",
105 "COLUMN_NAME": "displayName",
106 "DATA_TYPE": "TEXT",
107 "COLUMN_DESCRIPTION": "Display name of the variant, based on product's title + variant's title.",
108 "IS_NULLABLE": False,
109 },
110 # {
111 # "TABLE_NAME": "product_variants",
112 # "COLUMN_NAME": "events",
113 # "DATA_TYPE": "JSON",
114 # "COLUMN_DESCRIPTION": "The paginated list of events associated with the host subject.",
115 # "IS_NULLABLE": False
116 # },
117 {
118 "TABLE_NAME": "product_variants",
119 "COLUMN_NAME": "id",
120 "DATA_TYPE": "TEXT",
121 "COLUMN_DESCRIPTION": "A globally-unique ID.",
122 "IS_NULLABLE": False,
123 },
124 # {
125 # "TABLE_NAME": "product_variants",
126 # "COLUMN_NAME": "inventoryItem",
127 # "DATA_TYPE": "JSON",
128 # "COLUMN_DESCRIPTION": "The inventory item, which is used to query for inventory information.",
129 # "IS_NULLABLE": False
130 # },
131 # {
132 # "TABLE_NAME": "product_variants",
133 # "COLUMN_NAME": "inventoryPolicy",
134 # "DATA_TYPE": "TEXT",
135 # "COLUMN_DESCRIPTION": "Whether customers are allowed to place an order for the product variant when it's out of stock.",
136 # "IS_NULLABLE": False
137 # },
138 {
139 "TABLE_NAME": "product_variants",
140 "COLUMN_NAME": "inventoryQuantity",
141 "DATA_TYPE": "INT",
142 "COLUMN_DESCRIPTION": "The total sellable quantity of the variant.",
143 "IS_NULLABLE": None,
144 },
145 # {
146 # "TABLE_NAME": "product_variants",
147 # "COLUMN_NAME": "legacyResourceId",
148 # "DATA_TYPE": "INT",
149 # "COLUMN_DESCRIPTION": "The ID of the corresponding resource in the REST Admin API.",
150 # "IS_NULLABLE": False
151 # },
152 # {
153 # "TABLE_NAME": "product_variants",
154 # "COLUMN_NAME": "media",
155 # "DATA_TYPE": "JSON",
156 # "COLUMN_DESCRIPTION": "The media associated with the product variant.",
157 # "IS_NULLABLE": False
158 # },
159 # {
160 # "TABLE_NAME": "product_variants",
161 # "COLUMN_NAME": "metafield",
162 # "DATA_TYPE": "JSON",
163 # "COLUMN_DESCRIPTION": "A custom field, including its namespace and key, that's associated with a Shopify resource for the purposes of adding and storing additional information.",
164 # "IS_NULLABLE": None
165 # },
166 # {
167 # "TABLE_NAME": "product_variants",
168 # "COLUMN_NAME": "metafields",
169 # "DATA_TYPE": "JSON",
170 # "COLUMN_DESCRIPTION": "A list of custom fields that a merchant associates with a Shopify resource.",
171 # "IS_NULLABLE": False
172 # },
173 {
174 "TABLE_NAME": "product_variants",
175 "COLUMN_NAME": "position",
176 "DATA_TYPE": "INT",
177 "COLUMN_DESCRIPTION": "The order of the product variant in the list of product variants. The first position in the list is 1.",
178 "IS_NULLABLE": False,
179 },
180 {
181 "TABLE_NAME": "product_variants",
182 "COLUMN_NAME": "price",
183 "DATA_TYPE": "JSON",
184 "COLUMN_DESCRIPTION": "The price of the product variant in the default shop currency.",
185 "IS_NULLABLE": False,
186 },
187 # {
188 # "TABLE_NAME": "product_variants",
189 # "COLUMN_NAME": "product",
190 # "DATA_TYPE": "JSON",
191 # "COLUMN_DESCRIPTION": "The product that this variant belongs to.",
192 # "IS_NULLABLE": False
193 # },
194 {
195 # Custom, extracted from "product"
196 "TABLE_NAME": "product_variants",
197 "COLUMN_NAME": "productId",
198 "DATA_TYPE": "JSON",
199 "COLUMN_DESCRIPTION": "ID of the product that this variant belongs to.",
200 "IS_NULLABLE": None,
201 },
202 # {
203 # "TABLE_NAME": "product_variants",
204 # "COLUMN_NAME": "productParents",
205 # "DATA_TYPE": "JSON",
206 # "COLUMN_DESCRIPTION": "A list of products that have product variants that contain this variant as a product component.",
207 # "IS_NULLABLE": False
208 # },
209 # {
210 # "TABLE_NAME": "product_variants",
211 # "COLUMN_NAME": "productVariantComponents",
212 # "DATA_TYPE": "JSON",
213 # "COLUMN_DESCRIPTION": "A list of the product variant components.",
214 # "IS_NULLABLE": False
215 # },
216 {
217 "TABLE_NAME": "product_variants",
218 "COLUMN_NAME": "requiresComponents",
219 "DATA_TYPE": "BOOL",
220 "COLUMN_DESCRIPTION": "Whether a product variant requires components. The default value is false. If true, then the product variant can only be purchased as a parent bundle with components and it will be omitted from channels that don't support bundles.",
221 "IS_NULLABLE": False,
222 },
223 # {
224 # "TABLE_NAME": "product_variants",
225 # "COLUMN_NAME": "selectedOptions",
226 # "DATA_TYPE": "JSON",
227 # "COLUMN_DESCRIPTION": "List of product options applied to the variant.",
228 # "IS_NULLABLE": False
229 # },
230 {
231 "TABLE_NAME": "product_variants",
232 "COLUMN_NAME": "sellableOnlineQuantity",
233 "DATA_TYPE": "INT",
234 "COLUMN_DESCRIPTION": "The total sellable quantity of the variant for online channels. This doesn't represent the total available inventory or capture limitations based on customer location.",
235 "IS_NULLABLE": False,
236 },
237 # {
238 # "TABLE_NAME": "product_variants",
239 # "COLUMN_NAME": "sellingPlanGroups",
240 # "DATA_TYPE": "JSON",
241 # "COLUMN_DESCRIPTION": "A list of all selling plan groups defined in the current shop associated with the product variant.",
242 # "IS_NULLABLE": False
243 # },
244 {
245 "TABLE_NAME": "product_variants",
246 "COLUMN_NAME": "sellingPlanGroupsCount",
247 "DATA_TYPE": "JSON",
248 "COLUMN_DESCRIPTION": "Count of selling plan groups associated with the product variant.",
249 "IS_NULLABLE": None,
250 },
251 {
252 "TABLE_NAME": "product_variants",
253 "COLUMN_NAME": "showUnitPrice",
254 "DATA_TYPE": "BOOL",
255 "COLUMN_DESCRIPTION": "Whether to show the unit price for this product variant.",
256 "IS_NULLABLE": False,
257 },
258 {
259 "TABLE_NAME": "product_variants",
260 "COLUMN_NAME": "sku",
261 "DATA_TYPE": "TEXT",
262 "COLUMN_DESCRIPTION": "A case-sensitive identifier for the product variant in the shop. Required in order to connect to a fulfillment service.",
263 "IS_NULLABLE": None,
264 },
265 {
266 "TABLE_NAME": "product_variants",
267 "COLUMN_NAME": "taxable",
268 "DATA_TYPE": "BOOL",
269 "COLUMN_DESCRIPTION": "Whether a tax is charged when the product variant is sold.",
270 "IS_NULLABLE": False,
271 },
272 {
273 "TABLE_NAME": "product_variants",
274 "COLUMN_NAME": "title",
275 "DATA_TYPE": "TEXT",
276 "COLUMN_DESCRIPTION": "The title of the product variant.",
277 "IS_NULLABLE": False,
278 },
279 # {
280 # "TABLE_NAME": "product_variants",
281 # "COLUMN_NAME": "translations",
282 # "DATA_TYPE": "JSON",
283 # "COLUMN_DESCRIPTION": "The published translations associated with the resource.",
284 # "IS_NULLABLE": False
285 # },
286 {
287 "TABLE_NAME": "product_variants",
288 "COLUMN_NAME": "unitPrice",
289 "DATA_TYPE": "JSON",
290 "COLUMN_DESCRIPTION": "The unit price value for the variant based on the variant measurement.",
291 "IS_NULLABLE": None,
292 },
293 # {
294 # "TABLE_NAME": "product_variants",
295 # "COLUMN_NAME": "unitPriceMeasurement",
296 # "DATA_TYPE": "JSON",
297 # "COLUMN_DESCRIPTION": "The unit price measurement for the variant.",
298 # "IS_NULLABLE": None
299 # },
300 {
301 "TABLE_NAME": "product_variants",
302 "COLUMN_NAME": "updatedAt",
303 "DATA_TYPE": "TIMESTAMP",
304 "COLUMN_DESCRIPTION": "The date and time (ISO 8601 format) when the product variant was last modified.",
305 "IS_NULLABLE": False,
306 },
307]