Coverage for mindsdb / integrations / handlers / shopify_handler / models / customers.py: 0%
29 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 AliasesEnum, MailingAddress, MoneyV2
2from .utils import Nodes, Extract
5class Customers(AliasesEnum):
6 """A class to represent a Shopify GraphQL customer.
7 Reference: https://shopify.dev/docs/api/admin-graphql/latest/objects/Customer
8 Require `read_customers` permission.
9 """
11 addresses = MailingAddress
12 addressesV2 = Nodes(MailingAddress)
13 amountSpent = MoneyV2
14 canDelete = "canDelete"
15 # companyContactProfiles = CompanyContact
16 createdAt = "createdAt"
17 dataSaleOptOut = "dataSaleOptOut"
18 defaultAddress = MailingAddress
19 country = Extract("defaultAddress", "country") # Custom
20 # defaultEmailAddress = defaultEmailAddress
21 emailAddress = Extract("defaultEmailAddress", "emailAddress") # Custom
22 # defaultPhoneNumber = "defaultPhoneNumber"
23 phoneNumber = Extract("defaultPhoneNumber", "phoneNumber") # Custom
24 displayName = "displayName"
25 # events = "events"
26 firstName = "firstName"
27 id = "id"
28 # image = "image"
29 lastName = "lastName"
30 # lastOrder = "lastOrder"
31 # legacyResourceId = "legacyResourceId"
32 lifetimeDuration = "lifetimeDuration"
33 locale = "locale"
34 # mergeable = "mergeable"
35 # metafield = "metafield"
36 # metafields = "metafields"
37 multipassIdentifier = "multipassIdentifier"
38 note = "note"
39 numberOfOrders = "numberOfOrders"
40 # orders = "orders"
41 # paymentMethods = "paymentMethods"
42 productSubscriberStatus = "productSubscriberStatus"
43 state = "state"
44 # statistics = "statistics"
45 # storeCreditAccounts = "storeCreditAccounts"
46 # subscriptionContracts = "subscriptionContracts"
47 tags = "tags"
48 taxExempt = "taxExempt"
49 # taxExemptions = "taxExemptions"
50 updatedAt = "updatedAt"
51 verifiedEmail = "verifiedEmail"
54columns = [
55 {
56 "TABLE_NAME": "customers",
57 "COLUMN_NAME": "addresses",
58 "DATA_TYPE": "JSON",
59 "COLUMN_DESCRIPTION": "A list of addresses associated with the customer.",
60 "IS_NULLABLE": False,
61 },
62 {
63 "TABLE_NAME": "customers",
64 "COLUMN_NAME": "addressesV2",
65 "DATA_TYPE": "JSON",
66 "COLUMN_DESCRIPTION": "The addresses associated with the customer.",
67 "IS_NULLABLE": False,
68 },
69 {
70 "TABLE_NAME": "customers",
71 "COLUMN_NAME": "amountSpent",
72 "DATA_TYPE": "JSON",
73 "COLUMN_DESCRIPTION": "The total amount that the customer has spent on orders in their lifetime.",
74 "IS_NULLABLE": False,
75 },
76 {
77 "TABLE_NAME": "customers",
78 "COLUMN_NAME": "canDelete",
79 "DATA_TYPE": "BOOLEAN",
80 "COLUMN_DESCRIPTION": "Whether the merchant can delete the customer from their store. A customer can be deleted from a store only if they haven't yet made an order. After a customer makes an order, they can't be deleted from a store.",
81 "IS_NULLABLE": False,
82 },
83 # {
84 # "TABLE_NAME": "customers",
85 # "COLUMN_NAME": "companyContactProfiles",
86 # "DATA_TYPE": "JSON",
87 # "COLUMN_DESCRIPTION": "A list of the customer's company contact profiles.",
88 # "IS_NULLABLE": False
89 # },
90 {
91 "TABLE_NAME": "customers",
92 "COLUMN_NAME": "createdAt",
93 "DATA_TYPE": "TIMESTAMP",
94 "COLUMN_DESCRIPTION": "The date and time when the customer was added to the store.",
95 "IS_NULLABLE": False,
96 },
97 {
98 "TABLE_NAME": "customers",
99 "COLUMN_NAME": "dataSaleOptOut",
100 "DATA_TYPE": "BOOLEAN",
101 "COLUMN_DESCRIPTION": "Whether the customer has opted out of having their data sold.",
102 "IS_NULLABLE": False,
103 },
104 {
105 "TABLE_NAME": "customers",
106 "COLUMN_NAME": "defaultAddress",
107 "DATA_TYPE": "JSON",
108 "COLUMN_DESCRIPTION": "The default address associated with the customer.",
109 "IS_NULLABLE": None,
110 },
111 {
112 # Custom field, extracted from defaultAddress
113 "TABLE_NAME": "customers",
114 "COLUMN_NAME": "country",
115 "DATA_TYPE": "JSON",
116 "COLUMN_DESCRIPTION": "The coutry associated with the customer.",
117 "IS_NULLABLE": None,
118 },
119 # {
120 # "TABLE_NAME": "customers",
121 # "COLUMN_NAME": "defaultEmailAddress",
122 # "DATA_TYPE": "JSON",
123 # "COLUMN_DESCRIPTION": "The customer's default email address.",
124 # "IS_NULLABLE": None
125 # },
126 {
127 # Custom field, extracted from defaultEmailAddress
128 "TABLE_NAME": "customers",
129 "COLUMN_NAME": "emailAddress",
130 "DATA_TYPE": "TEXT",
131 "COLUMN_DESCRIPTION": "The customer's default email address.",
132 "IS_NULLABLE": None,
133 },
134 # {
135 # "TABLE_NAME": "customers",
136 # "COLUMN_NAME": "defaultPhoneNumber",
137 # "DATA_TYPE": "JSON",
138 # "COLUMN_DESCRIPTION": "The customer's default phone number.",
139 # "IS_NULLABLE": None
140 # },
141 {
142 # Custom field, extracted from defaultPhoneNumber
143 "TABLE_NAME": "customers",
144 "COLUMN_NAME": "phoneNumber",
145 "DATA_TYPE": "TEXT",
146 "COLUMN_DESCRIPTION": "The customer's default phone number.",
147 "IS_NULLABLE": None,
148 },
149 {
150 "TABLE_NAME": "customers",
151 "COLUMN_NAME": "displayName",
152 "DATA_TYPE": "TEXT",
153 "COLUMN_DESCRIPTION": "The full name of the customer, based on the values for first_name and last_name. If the first_name and last_name are not available, then this falls back to the customer's email address, and if that is not available, the customer's phone number.",
154 "IS_NULLABLE": False,
155 },
156 # {
157 # "TABLE_NAME": "customers",
158 # "COLUMN_NAME": "events",
159 # "DATA_TYPE": "JSON",
160 # "COLUMN_DESCRIPTION": "A list of events associated with the customer.",
161 # "IS_NULLABLE": False
162 # },
163 {
164 "TABLE_NAME": "customers",
165 "COLUMN_NAME": "firstName",
166 "DATA_TYPE": "TEXT",
167 "COLUMN_DESCRIPTION": "The customer's first name.",
168 "IS_NULLABLE": None,
169 },
170 {
171 "TABLE_NAME": "customers",
172 "COLUMN_NAME": "id",
173 "DATA_TYPE": "TEXT",
174 "COLUMN_DESCRIPTION": "A globally-unique ID.",
175 "IS_NULLABLE": False,
176 },
177 # {
178 # "TABLE_NAME": "customers",
179 # "COLUMN_NAME": "image",
180 # "DATA_TYPE": "JSON",
181 # "COLUMN_DESCRIPTION": "The image associated with the customer.",
182 # "IS_NULLABLE": False
183 # },
184 {
185 "TABLE_NAME": "customers",
186 "COLUMN_NAME": "lastName",
187 "DATA_TYPE": "TEXT",
188 "COLUMN_DESCRIPTION": "The customer's last name.",
189 "IS_NULLABLE": None,
190 },
191 # {
192 # "TABLE_NAME": "customers",
193 # "COLUMN_NAME": "lastOrder",
194 # "DATA_TYPE": "JSON",
195 # "COLUMN_DESCRIPTION": "The customer's last order.",
196 # "IS_NULLABLE": None
197 # },
198 # {
199 # "TABLE_NAME": "customers",
200 # "COLUMN_NAME": "legacyResourceId",
201 # "DATA_TYPE": "INT",
202 # "COLUMN_DESCRIPTION": "The ID of the corresponding resource in the REST Admin API.",
203 # "IS_NULLABLE": False
204 # },
205 {
206 "TABLE_NAME": "customers",
207 "COLUMN_NAME": "lifetimeDuration",
208 "DATA_TYPE": "TEXT",
209 "COLUMN_DESCRIPTION": "The amount of time since the customer was first added to the store. Example: 'about 12 years'.",
210 "IS_NULLABLE": False,
211 },
212 {
213 "TABLE_NAME": "customers",
214 "COLUMN_NAME": "locale",
215 "DATA_TYPE": "TEXT",
216 "COLUMN_DESCRIPTION": "The customer's locale.",
217 "IS_NULLABLE": False,
218 },
219 # {
220 # "TABLE_NAME": "customers",
221 # "COLUMN_NAME": "mergeable",
222 # "DATA_TYPE": "JSON",
223 # "COLUMN_DESCRIPTION": "Whether the customer can be merged with another customer.",
224 # "IS_NULLABLE": False
225 # },
226 # {
227 # "TABLE_NAME": "customers",
228 # "COLUMN_NAME": "metafield",
229 # "DATA_TYPE": "JSON",
230 # "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.",
231 # "IS_NULLABLE": None
232 # },
233 # {
234 # "TABLE_NAME": "customers",
235 # "COLUMN_NAME": "metafields",
236 # "DATA_TYPE": "JSON",
237 # "COLUMN_DESCRIPTION": "A list of custom fields that a merchant associates with a Shopify resource.",
238 # "IS_NULLABLE": False
239 # },
240 {
241 "TABLE_NAME": "customers",
242 "COLUMN_NAME": "multipassIdentifier",
243 "DATA_TYPE": "TEXT",
244 "COLUMN_DESCRIPTION": "A unique identifier for the customer that's used with Multipass login.",
245 "IS_NULLABLE": None,
246 },
247 {
248 "TABLE_NAME": "customers",
249 "COLUMN_NAME": "note",
250 "DATA_TYPE": "TEXT",
251 "COLUMN_DESCRIPTION": "A note about the customer.",
252 "IS_NULLABLE": None,
253 },
254 {
255 "TABLE_NAME": "customers",
256 "COLUMN_NAME": "numberOfOrders",
257 "DATA_TYPE": "INT",
258 "COLUMN_DESCRIPTION": "The number of orders that the customer has made at the store in their lifetime.",
259 "IS_NULLABLE": False,
260 },
261 # {
262 # "TABLE_NAME": "customers",
263 # "COLUMN_NAME": "orders",
264 # "DATA_TYPE": "JSON",
265 # "COLUMN_DESCRIPTION": "A list of the customer's orders.",
266 # "IS_NULLABLE": False
267 # },
268 # {
269 # "TABLE_NAME": "customers",
270 # "COLUMN_NAME": "paymentMethods",
271 # "DATA_TYPE": "JSON",
272 # "COLUMN_DESCRIPTION": "A list of the customer's payment methods.",
273 # "IS_NULLABLE": False
274 # },
275 {
276 "TABLE_NAME": "customers",
277 "COLUMN_NAME": "productSubscriberStatus",
278 "DATA_TYPE": "TEXT",
279 "COLUMN_DESCRIPTION": "Possible subscriber states of a customer defined by their subscription contracts.",
280 "IS_NULLABLE": False,
281 },
282 {
283 "TABLE_NAME": "customers",
284 "COLUMN_NAME": "state",
285 "DATA_TYPE": "TEXT",
286 "COLUMN_DESCRIPTION": "The state of the customer's account with the shop. Please note that this only meaningful when Classic Customer Accounts is active.",
287 "IS_NULLABLE": False,
288 },
289 # {
290 # "TABLE_NAME": "customers",
291 # "COLUMN_NAME": "statistics",
292 # "DATA_TYPE": "JSON",
293 # "COLUMN_DESCRIPTION": "The statistics for a given customer.",
294 # "IS_NULLABLE": False
295 # },
296 # {
297 # "TABLE_NAME": "customers",
298 # "COLUMN_NAME": "storeCreditAccounts",
299 # "DATA_TYPE": "JSON",
300 # "COLUMN_DESCRIPTION": "Returns a list of store credit accounts that belong to the owner resource. A store credit account owner can hold multiple accounts each with a different currency.",
301 # "IS_NULLABLE": False
302 # },
303 # {
304 # "TABLE_NAME": "customers",
305 # "COLUMN_NAME": "subscriptionContracts",
306 # "DATA_TYPE": "JSON",
307 # "COLUMN_DESCRIPTION": "A list of the customer's subscription contracts.",
308 # "IS_NULLABLE": False
309 # },
310 {
311 "TABLE_NAME": "customers",
312 "COLUMN_NAME": "tags",
313 "DATA_TYPE": "JSON",
314 "COLUMN_DESCRIPTION": "A comma separated list of tags that have been added to the customer.",
315 "IS_NULLABLE": False,
316 },
317 {
318 "TABLE_NAME": "customers",
319 "COLUMN_NAME": "taxExempt",
320 "DATA_TYPE": "BOOLEAN",
321 "COLUMN_DESCRIPTION": "Whether the customer is exempt from being charged taxes on their orders.",
322 "IS_NULLABLE": False,
323 },
324 # {
325 # "TABLE_NAME": "customers",
326 # "COLUMN_NAME": "taxExemptions",
327 # "DATA_TYPE": "JSON",
328 # "COLUMN_DESCRIPTION": "The list of tax exemptions applied to the customer.",
329 # "IS_NULLABLE": False
330 # },
331 {
332 "TABLE_NAME": "customers",
333 "COLUMN_NAME": "updatedAt",
334 "DATA_TYPE": "TIMESTAMP",
335 "COLUMN_DESCRIPTION": "The date and time when the customer was last updated.",
336 "IS_NULLABLE": False,
337 },
338 {
339 "TABLE_NAME": "customers",
340 "COLUMN_NAME": "verifiedEmail",
341 "DATA_TYPE": "BOOLEAN",
342 "COLUMN_DESCRIPTION": "Whether the customer has verified their email address. Defaults to true if the customer is created through the Shopify admin or API.",
343 "IS_NULLABLE": False,
344 },
345]