Subversion Repositories SmartDukaan

Rev

Rev 21853 | Rev 22309 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
94 ashish 1
'''
2
Created on 22-Mar-2010
3
 
4
@author: ashish
5
'''
4873 mandeep.dh 6
from elixir import metadata, setup_all
94 ashish 7
from elixir.entity import Entity
8
from elixir.fields import Field
4873 mandeep.dh 9
from elixir.options import using_options, using_table_options
5318 rajveer 10
from elixir.relationships import OneToMany, ManyToOne
4873 mandeep.dh 11
from sqlalchemy import create_engine
12363 kshitij.so 12
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Text, Enum, BigInteger, Date
4873 mandeep.dh 13
import datetime
14
import elixir
94 ashish 15
 
626 chandransh 16
class EntityIDGenerator(Entity):
17
    id=Field(Integer, primary_key=True)
18
    using_options(shortnames=True)
746 rajveer 19
    using_table_options(mysql_engine="InnoDB")
122 ashish 20
 
94 ashish 21
class Item(Entity):
122 ashish 22
    id = Field(Integer, primary_key=True, autoincrement=True)
963 chandransh 23
    product_group = Field(String(100))
4917 phani.kuma 24
    brand = Field(String(100), default='', server_default='')
25
    model_number = Field(String(50), default='', server_default='')
26
    model_name = Field(String(100), default='', server_default='')
27
    color = Field(String(20), default='', server_default='')
28
    category = Field(Integer, default=0, server_default="0")
483 rajveer 29
    comments = Field(String(200))
122 ashish 30
    catalog_item_id = Field(Integer)
31
    feature_id = Field(Integer)
32
    feature_description = Field(String(200))
483 rajveer 33
    mrp = Field(Float)
34
    sellingPrice = Field(Float)
35
    weight = Field(Float)
122 ashish 36
    addedOn = Field(DateTime)
609 chandransh 37
    updatedOn = Field(DateTime)
122 ashish 38
    startDate = Field(DateTime)
39
    retireDate = Field(DateTime)
5217 amit.gupta 40
    comingSoonStartDate = Field(DateTime)
41
    expectedArrivalDate = Field(DateTime)
483 rajveer 42
    status = Field(Integer)
2035 rajveer 43
    status_description = Field(String(100))
609 chandransh 44
    bestDealText = Field(String(100))
6777 vikram.rag 45
    bestDealsDetailsText = Field(String(1000))
46
    bestDealsDetailsLink = Field(String(200))
630 chandransh 47
    bestDealValue = Field(Float)
621 chandransh 48
    bestSellingRank = Field(Integer)
103 ashish 49
    statusChangeLog = OneToMany("ItemChangeLog")
1910 varun.gupt 50
    defaultForEntity = Field(Boolean)
2251 ankur.sing 51
    risky = Field(Boolean)
3355 chandransh 52
    expectedDelay = Field(Integer)
4295 varun.gupt 53
    warranty_period = Field(Integer)
4406 anupam.sin 54
    isWarehousePreferenceSticky = Field(Boolean)
4506 phani.kuma 55
    preferredVendor = Field(Integer)
5135 mandeep.dh 56
    type = Field(Enum('SERIALIZED', 'NON_SERIALIZED'), default = 'NON_SERIALIZED', server_default='NON_SERIALIZED')
5385 phani.kuma 57
    hasItemNo = Field(Boolean)
7256 rajveer 58
    activeOnStore = Field(Boolean)
6241 amit.gupta 59
    showSellingPrice = Field(Boolean)
6805 anupam.sin 60
    preferredInsurer = Field(Integer)
7291 vikram.rag 61
    asin = Field(String(20))
62
    holdInventory = Field(Integer, default=0, server_default="0")
63
    defaultInventory = Field(Integer, default=0, server_default="0")
9841 rajveer 64
    holdOverride = Field(Boolean)
18150 kshitij.so 65
    packQuantity = Field(Integer, default=1, server_default="1")
66
    quantityStep = Field(Integer, default=1, server_default="1")
67
    minimumBuyQuantity = Field(Integer, default=1, server_default="1")
18414 kshitij.so 68
    maximumBuyQuantity = Field(Integer, default=0, server_default="0")
21838 amit.gupta 69
    hsnCode = Field(String(12))
746 rajveer 70
    using_options(shortnames=True)
71
    using_table_options(mysql_engine="InnoDB")
103 ashish 72
 
94 ashish 73
    def __repr__(self):
122 ashish 74
        return "<Item>%d</item>" % (self.id)
1308 chandransh 75
 
7330 amit.gupta 76
class ItemVatMaster(Entity):
77
    itemId = Field(Integer, primary_key=True,  autoincrement=False)
78
    stateId = Field(Integer, primary_key=True,  autoincrement=False)
79
    vatPercentage = Field(Float)
80
    using_options(shortnames=True)
81
    using_table_options(mysql_engine="InnoDB")
21838 amit.gupta 82
 
83
class CategoryHsnCodes(Entity):
84
    categoryId = Field(Integer, primary_key=True)
85
    hsnCode = Field(String(12), primary_key=True)
21853 amit.gupta 86
    description = Field(String(64))
21838 amit.gupta 87
    using_options(shortnames=True)
88
    using_table_options(mysql_engine="InnoDB")
89
 
7330 amit.gupta 90
 
91
 
103 ashish 92
class ItemChangeLog(Entity):
122 ashish 93
    id = Field(Integer, primary_key=True, autoincrement=True)
103 ashish 94
    old_status = Field(Integer)
95
    new_status = Field(Integer)
1308 chandransh 96
    timestamp = Field(DateTime)
103 ashish 97
    item = ManyToOne("Item")
746 rajveer 98
    using_options(shortnames=True)
99
    using_table_options(mysql_engine="InnoDB")
94 ashish 100
 
103 ashish 101
    def __repr__(self):
102
        return "<Log><id>%d</id><item>%d</item><old_status>%d</old_status><new_status>%d</new_status></Log>" %(self.id,self.item.id, self.old_status, self.new_status)    
94 ashish 103
 
635 rajveer 104
class Category(Entity):
1970 rajveer 105
    id = Field(Integer, primary_key=True, autoincrement=False)
106
    label = Field(String(50))
107
    description = Field(String(200))
108
    parent_category_id = Field(Integer)
4762 phani.kuma 109
    display_name = Field(String(50))
746 rajveer 110
    using_options(shortnames=True)
111
    using_table_options(mysql_engine="InnoDB")
1970 rajveer 112
 
3008 rajveer 113
class SimilarItems(Entity):
114
    item = ManyToOne('Item', primary_key=True)
115
    catalog_item_id = Field(Integer, primary_key=True, autoincrement=False)
116
    using_options(shortnames=True)
117
    using_table_options(mysql_engine="InnoDB")
118
 
3079 rajveer 119
class ProductNotification(Entity):
120
    item = ManyToOne('Item', primary_key=True)
121
    email = Field(String(100), primary_key=True, autoincrement=False)
122
    addedOn = Field(DateTime, primary_key=True, autoincrement=False) 
123
    using_options(shortnames=True)
124
    using_table_options(mysql_engine="InnoDB")
3557 rajveer 125
 
126
class Source(Entity):
127
    id = Field(Integer, primary_key=True, autoincrement=True)
128
    name = Field(String(50))
129
    identifier = Field(String(100))
130
    using_options(shortnames=True)
131
    using_table_options(mysql_engine="InnoDB")
6511 kshitij.so 132
 
3557 rajveer 133
class SourceItemPricing(Entity):
134
    source = ManyToOne('Source', primary_key=True)
135
    item = ManyToOne('Item', primary_key=True)
136
    mrp = Field(Float)
137
    sellingPrice = Field(Float)
138
    using_options(shortnames=True)
139
    using_table_options(mysql_engine="InnoDB")
746 rajveer 140
 
4649 phani.kuma 141
class AuthorizationLog(Entity):
142
    id = Field(Integer, primary_key=True, autoincrement = True)    
143
    timestamp = Field(DateTime, default=datetime.datetime.now())
144
    item = ManyToOne('Item')
145
    username = Field(String(30))
146
    reason = Field(Text)
147
    using_options(shortnames=True)
148
    using_table_options(mysql_engine="InnoDB")
149
 
5504 phani.kuma 150
class VoucherItemMapping(Entity):
5512 rajveer 151
    voucherType = Field(Integer, primary_key=True)
5504 phani.kuma 152
    item = ManyToOne('Item', primary_key=True)
153
    amount = Field(Integer, default=0, server_default="0")
154
    using_options(shortnames=True)
155
    using_table_options(mysql_engine="InnoDB")
156
 
6039 amit.gupta 157
class CategoryVatMaster(Entity):
7330 amit.gupta 158
    categoryId = Field(Integer, primary_key=True, autoincrement=False)
159
    stateId = Field(Integer, primary_key=True, autoincrement=False)
160
    minVal = Field(Integer, primary_key=True,  autoincrement=False)
161
    maxVal = Field(Integer, primary_key=True,  autoincrement=False)
6039 amit.gupta 162
    vatPercent = Field(Float)
163
    using_options(shortnames=True)
164
    using_table_options(mysql_engine="InnoDB")
165
 
21838 amit.gupta 166
class CentralGstMaster(Entity):
167
    hsnCode = Field(String(12), primary_key=True)
168
    startDate = Field(DateTime, primary_key=True)
169
    gstPercent = Field(Float)
170
    using_options(shortnames=True)
171
    using_table_options(mysql_engine="InnoDB")
172
 
173
class StateGstMaster(Entity):
174
    hsnCode = Field(String(12), primary_key=True)
175
    startDate = Field(DateTime, primary_key=True)
176
    stateId = Field(Integer, primary_key=True, autoincrement=False)
177
    sgstPercent = Field(Float)
178
    cgstPercent = Field(Float)
179
    using_options(shortnames=True)
180
    using_table_options(mysql_engine="InnoDB")
181
 
6255 rajveer 182
class OOSTracker(Entity):
183
    itemId = Field(Integer, primary_key=True)
184
    using_options(shortnames=True)
185
    using_table_options(mysql_engine="InnoDB")
6532 amit.gupta 186
 
187
class EntityTag(Entity):
188
    tag = Field(String(100),primary_key=True)
189
    entityId = Field(Integer, primary_key=True, autoincrement=False)
190
    using_options(shortnames=True)
191
    using_table_options(mysql_engine="InnoDB")
6848 kshitij.so 192
 
193
class Banner(Entity):
194
    bannerName = Field(String(100),primary_key=True)
195
    imageName = Field(String(100))
196
    link = Field(String(400))
197
    priority = Field(Integer)
198
    hasMap = Field(Boolean)
9156 amit.gupta 199
    bannerType = Field(Integer,primary_key=True, autoincrement=False)
6848 kshitij.so 200
    using_options(shortnames=True)
201
    using_table_options(mysql_engine="InnoDB")
202
 
203
class BannerMap(Entity):
204
    bannerName = Field(String(100))
205
    mapLink = Field(String(400))
206
    coordinates = Field(String(20))
9155 kshitij.so 207
    bannerType = Field(Integer)
6848 kshitij.so 208
    using_options(shortnames=True)
209
    using_table_options(mysql_engine="InnoDB")
8579 kshitij.so 210
 
211
class BannerUriMapping(Entity):
212
    bannerName = Field(String(100))
213
    uri = Field(String(100))
214
    isActive = Field(Boolean)
9155 kshitij.so 215
    bannerType = Field(Integer)
10097 kshitij.so 216
    target = Field(Boolean)
8579 kshitij.so 217
    using_options(shortnames=True)
218
    using_table_options(mysql_engine="InnoDB")
219
 
220
class Campaign(Entity):
221
    id = Field(Integer,primary_key=True)
222
    campaignName = Field(String(255))
223
    imageName = Field(String(255))
224
    using_options(shortnames=True)
225
    using_table_options(mysql_engine="InnoDB")
6255 rajveer 226
 
6805 anupam.sin 227
class ItemInsurerMapping(Entity):
228
    id = Field(Integer, primary_key=True, autoincrement=True)
229
    itemId = Field(Integer)
230
    insurerId = Field(Integer)
231
    premiumType = Field(Integer)
232
    premiumAmount = Field(Float)
9299 kshitij.so 233
    insurerType = Field(Integer)
6805 anupam.sin 234
    using_options(shortnames=True)
235
    using_table_options(mysql_engine="InnoDB")
236
 
237
class Insurer(Entity):
238
    id = Field(Integer, primary_key=True, autoincrement=True)
239
    name = Field(String(255))
240
    address = Field(String(255))
6903 anupam.sin 241
    declaredAmount = Field(BigInteger)
242
    creditedAmount = Field(BigInteger)
9299 kshitij.so 243
    insurerType = Field(Integer)
6805 anupam.sin 244
    using_options(shortnames=True)
245
    using_table_options(mysql_engine="InnoDB")
7190 amar.kumar 246
 
247
class FreebieItem(Entity):
248
    itemId = Field(Integer, primary_key=True)
249
    freebieItemId = Field(Integer)
250
    using_options(shortnames=True)
251
    using_table_options(mysql_engine="InnoDB")
7256 rajveer 252
 
7272 amit.gupta 253
class BrandInfo(Entity):
254
    name = Field(String(255), primary_key=True)
255
    serviceCenterLocatorUrl = Field(String(255))
256
    using_options(shortnames=True)
257
    using_table_options(mysql_engine="InnoDB")
258
 
7256 rajveer 259
class StorePricing(Entity):
260
    item = ManyToOne('Item', primary_key=True)
261
    recommendedPrice = Field(Float)
262
    minPrice = Field(Float)
263
    maxPrice = Field(Float)
264
    minAdvancePrice = Field(Float)
7308 rajveer 265
    freebieItemId = Field(Integer)
7351 rajveer 266
    absoluteMinPrice = Field(Float)
7308 rajveer 267
    bestDealText = Field(String(100))
7256 rajveer 268
    using_options(shortnames=True)
7291 vikram.rag 269
    using_table_options(mysql_engine="InnoDB")    
270
 
7281 kshitij.so 271
class Amazonlisted(Entity):
7396 kshitij.so 272
    itemId = Field(Integer, primary_key=True, autoincrement=False)
7281 kshitij.so 273
    asin = Field(String(255))
274
    name = Field(String(255))
275
    brand = Field(String(255))
276
    model = Field(String(255))
277
    manufacturer_name = Field(String(255))
278
    part_number = Field(String(255))
279
    ean = Field(String(255))
280
    upc = Field(String(255))
281
    fbaPrice = Field(Float)
10909 vikram.rag 282
    fbbPrice = Field(Float)
12888 kshitij.so 283
    fbgPrice = Field(Float)
15687 kshitij.so 284
    fbdPrice = Field(Float)
7281 kshitij.so 285
    sellingPrice = Field(Float)
286
    isFba = Field(Boolean)
287
    isNonFba = Field(Boolean)
10909 vikram.rag 288
    isFbb = Field(Boolean)
12888 kshitij.so 289
    isFbg = Field(Boolean)
15687 kshitij.so 290
    isFbd = Field(Boolean)
7281 kshitij.so 291
    isInventoryOverride = Field(Boolean)
12448 kshitij.so 292
    otherCost = Field(Float, default=0.0, server_default="0.0")
7281 kshitij.so 293
    color = Field(String(255))
294
    category = Field(String(255))
7367 kshitij.so 295
    handlingTime = Field(Integer)
296
    isCustomTime = Field(Boolean)
7516 vikram.rag 297
    category_code = Field(Integer, default=0, server_default="0")
10920 vikram.rag 298
    fbbListedOn = Field(DateTime)
7770 kshitij.so 299
    mfnPriceLastUpdatedOn = Field(DateTime)
300
    fbaPriceLastUpdatedOn = Field(DateTime)
10909 vikram.rag 301
    fbbPriceLastUpdatedOn = Field(DateTime)
12888 kshitij.so 302
    fbgPriceLastUpdatedOn = Field(DateTime)
15687 kshitij.so 303
    fbdPriceLastUpdatedOn = Field(DateTime)
7770 kshitij.so 304
    mfnPriceLastUpdatedOnSc = Field(DateTime)
305
    fbaPriceLastUpdatedOnSc = Field(DateTime)
10909 vikram.rag 306
    fbbPriceLastUpdatedOnSc = Field(DateTime)
12888 kshitij.so 307
    fbgPriceLastUpdatedOnSc = Field(DateTime)
15687 kshitij.so 308
    fbdPriceLastUpdatedOnSc = Field(DateTime)
8139 kshitij.so 309
    suppressMfnPriceUpdate = Field(Boolean)
8140 kshitij.so 310
    suppressFbaPriceUpdate = Field(Boolean)
10909 vikram.rag 311
    suppressFbbPriceUpdate = Field(Boolean)
12888 kshitij.so 312
    suppressFbgPriceUpdate = Field(Boolean)
15687 kshitij.so 313
    suppressFbdPriceUpdate = Field(Boolean)
8619 kshitij.so 314
    taxCode = Field(String(255))
10909 vikram.rag 315
    fbbtaxCode = Field(String(255))
12888 kshitij.so 316
    fbgtaxCode = Field(String(255))
15687 kshitij.so 317
    fbdtaxCode = Field(String(255))
12363 kshitij.so 318
    overrrideWanlc = Field(Boolean)
319
    exceptionalWanlc = Field(Float)
12396 kshitij.so 320
    autoDecrement = Field(Boolean)
321
    autoIncrement = Field(Boolean)
322
    autoFavourite = Field(Boolean)
323
    manualFavourite = Field(Boolean)
12663 kshitij.so 324
    fbaPromoPrice = Field(Float, default=0.0, server_default="0.0")
325
    fbbPromoPrice = Field(Float, default=0.0, server_default="0.0")
12888 kshitij.so 326
    fbgPromoPrice = Field(Float, default=0.0, server_default="0.0")
15687 kshitij.so 327
    fbdPromoPrice = Field(Float, default=0.0, server_default="0.0")
12719 kshitij.so 328
    fbaPromoStartDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
329
    fbaPromoEndDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
330
    fbbPromoStartDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
331
    fbbPromoEndDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
12888 kshitij.so 332
    fbgPromoStartDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
333
    fbgPromoEndDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
15687 kshitij.so 334
    fbdPromoStartDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
335
    fbdPromoEndDate = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
12663 kshitij.so 336
    fbaPromotionActive = Field(Boolean)
337
    fbbPromotionActive = Field(Boolean)
12888 kshitij.so 338
    fbgPromotionActive = Field(Boolean)
15687 kshitij.so 339
    fbdPromotionActive = Field(Boolean)
340
    packagingHeight = Field(Float)
341
    packagingLength = Field(Float)
342
    packagingWidth = Field(Float)
343
    packagingWeight = Field(Float)
7281 kshitij.so 344
    using_options(shortnames=True)
345
    using_table_options(mysql_engine="InnoDB")
346
 
7977 kshitij.so 347
class PageViewEvents(Entity):
348
    id = Field(Integer, primary_key=True, autoincrement=True)
8139 kshitij.so 349
    catalogId = Field(Integer,index=True)
350
    url = Field(String(255),index=True)
7977 kshitij.so 351
    sellingPrice = Field(Float)
352
    comingSoon = Field(Boolean)
353
    ip = Field(String(255))
354
    sessionId = Field(String(255))
8139 kshitij.so 355
    eventTimestamp = Field(DateTime,index=True)
7977 kshitij.so 356
    using_options(shortnames=True)
357
    using_table_options(mysql_engine="InnoDB")
358
 
359
class CartEvents(Entity):
360
    id = Field(Integer, primary_key=True, autoincrement=True)
8139 kshitij.so 361
    catalogId = Field(Integer,index=True)
362
    itemId = Field(Integer,index=True)
7977 kshitij.so 363
    sellingPrice = Field(Float)
364
    inStock = Field(Boolean)
365
    comingSoon = Field(Boolean)
366
    ip = Field(String(255))
367
    sessionId = Field(String(255))
8139 kshitij.so 368
    eventTimestamp = Field(DateTime,index=True)
7977 kshitij.so 369
    using_options(shortnames=True)
370
    using_table_options(mysql_engine="InnoDB")
371
 
8182 amar.kumar 372
class EbayItem(Entity):
373
    ebayListingId = Field(String(32), primary_key=True)
374
    itemId = Field(Integer, primary_key=True, autoincrement = False)
375
    listingName = Field(String(255))
376
    listingPrice = Field(Float)
377
    listingExpiryDate = Field(DateTime)
378
    subsidy = Field(Float)
379
    defaultWarehouseId = Field(Integer)
380
    using_options(shortnames=True)
381
    using_table_options(mysql_engine="InnoDB")
8739 vikram.rag 382
 
383
class SnapdealItem(Entity):
384
    item_id = Field(Integer, primary_key=True, autoincrement = False)
385
    exceptionPrice = Field(Float)
386
    warehouseId = Field(Integer)
9242 kshitij.so 387
    transferPrice = Field(Float)
388
    sellingPrice = Field(Float)
389
    courierCost =  Field(Float)
11095 kshitij.so 390
    courierCostMarketplace = Field(Float)
9242 kshitij.so 391
    commission  =  Field(Float)
392
    serviceTax  =  Field(Float)
393
    updatedOn = Field(DateTime)
9404 vikram.rag 394
    maxNlc = Field(Float)
9478 kshitij.so 395
    skuAtSnapdeal = Field(String(255))
9242 kshitij.so 396
    isListedOnSnapdeal = Field(Boolean)
397
    suppressPriceFeed = Field(Boolean)
398
    suppressInventoryFeed = Field(Boolean)
9568 kshitij.so 399
    supc = Field(String(255))
9724 kshitij.so 400
    shippingTime = Field(Integer)
9779 kshitij.so 401
    priceUpdatedBy = Field(String(255))
14780 manish.sha 402
    isVoiListed = Field(Boolean)
403
    voiSellingPrice = Field(Float)
404
    suppressVoiPriceFeed = Field(Boolean)
405
    voiPriceLastUpdatedOn = Field(DateTime)
406
    voiSkuAtSnapdeal = Field(String(255))
407
    minimumPossibleSpVoi = Field(Float)
408
    minimumPossibleTpVoi = Field(Float)
409
    courierCostVoi = Field(Float)
410
    serviceTaxVoi = Field(Float)
411
    transferPriceVoi = Field(Float)
412
    commissionVoi = Field(Float)
14862 manish.sha 413
    courierCostMarketplaceVoi = Field(Float)
414
    commissionPercentageVoi = Field(Float)
8739 vikram.rag 415
    using_options(shortnames=True)
416
    using_table_options(mysql_engine="InnoDB")
9242 kshitij.so 417
 
10097 kshitij.so 418
class MarketPlaceUpdateHistory(Entity):
9242 kshitij.so 419
    id  = Field(Integer, primary_key=True, autoincrement = True)
420
    item_id = Field(Integer)
10097 kshitij.so 421
    source = Field(Integer)
422
    isListedOnSource = Field(Boolean)
9242 kshitij.so 423
    exceptionPrice = Field(Float)
424
    warehouseId = Field(Integer)
425
    transferPrice = Field(Float)
426
    sellingPrice = Field(Float)
427
    courierCost =  Field(Float)
11095 kshitij.so 428
    courierCostMarketplace = Field(Float)
9242 kshitij.so 429
    commission  =  Field(Float)
430
    serviceTax  =  Field(Float)
431
    suppressPriceFeed = Field(Boolean)
432
    suppressInventoryFeed = Field(Boolean)
9478 kshitij.so 433
    maxNlc = Field(Float)
10097 kshitij.so 434
    skuAtSource = Field(String(255))
9242 kshitij.so 435
    updatedOn = Field(DateTime)
10097 kshitij.so 436
    marketPlaceSerialNumber = Field(String(255))
9779 kshitij.so 437
    priceUpdatedBy = Field(String(255))
9242 kshitij.so 438
    using_options(shortnames=True)
439
    using_table_options(mysql_engine="InnoDB")
9724 kshitij.so 440
 
441
class MarketplaceItems(Entity):
442
    itemId = Field(Integer,primary_key=True, autoincrement = False)
443
    source = Field(Integer,primary_key=True, autoincrement = False)
444
    emiFee = Field(Float)
445
    courierCost = Field(Float)
11095 kshitij.so 446
    courierCostMarketplace = Field(Float)
9724 kshitij.so 447
    closingFee = Field(Float)
448
    returnProvision = Field(Float)
449
    commission = Field(Float)
10287 kshitij.so 450
    pgFee = Field(Float)
9724 kshitij.so 451
    vat = Field(Float)
452
    packagingCost = Field(Float)
453
    otherCost = Field(Float)
454
    serviceTax = Field(Float)
455
    autoIncrement = Field(Boolean)
456
    autoDecrement = Field(Boolean)
457
    manualFavourite = Field(Boolean)
458
    autoFavourite = Field(Boolean)
459
    currentSp = Field(Float)
460
    currentTp = Field(Float)
461
    minimumPossibleSp = Field(Float)
462
    minimumPossibleTp = Field(Float)
9909 kshitij.so 463
    maximumSellingPrice = Field(Float)
9724 kshitij.so 464
    lastCheckedTimestamp = Field(DateTime)
465
    using_options(shortnames=True)
466
    using_table_options(mysql_engine="InnoDB")
7977 kshitij.so 467
 
9621 manish.sha 468
class ProductFeedSubmit(Entity):
469
    catalogItemId = Field(Integer, primary_key=True)
470
    stockLinkedFeed = Field(Boolean)
471
    using_options(shortnames=True)
472
    using_table_options(mysql_engine="InnoDB")
9776 vikram.rag 473
 
474
class MarketPlaceItemPrice(Entity):    
475
    item_id = Field(Integer, primary_key=True, autoincrement=False)
476
    source = Field(Integer, primary_key=True, autoincrement=False)
477
    sellingPrice = Field(Float)
478
    lastUpdatedOn = Field(DateTime)
479
    lastUpdatedOnMarketplace = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 15:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
480
    suppressPriceFeed = Field(Boolean)
481
    isListedOnSource =  Field(Boolean)
482
    using_options(shortnames=True)
483
    using_table_options(mysql_engine="InnoDB")
9242 kshitij.so 484
 
9779 kshitij.so 485
class SourcePercentageMaster(Entity):
486
    source = Field(Integer, primary_key=True, autoincrement=False)
487
    emiFee = Field(Float)
488
    closingFee = Field(Float)
489
    returnProvision = Field(Float)
490
    commission = Field(Float)
10287 kshitij.so 491
    pgFee = Field(Float)
9884 kshitij.so 492
    competitorCommissionAccessory = Field(Float)
493
    competitorCommissionOther = Field(Float)
9779 kshitij.so 494
    serviceTax = Field(Float)
495
    using_options(shortnames=True)
496
    using_table_options(mysql_engine="InnoDB")
497
 
498
class SourceItemPercentage(Entity):
499
    item_id = Field(Integer, primary_key=True, autoincrement=False)
500
    source = Field(Integer, primary_key=True, autoincrement=False)
501
    emiFee = Field(Float)
502
    closingFee = Field(Float)
503
    returnProvision = Field(Float)
504
    commission = Field(Float)
10287 kshitij.so 505
    pgFee = Field(Float)
9884 kshitij.so 506
    competitorCommissionAccessory = Field(Float)
507
    competitorCommissionOther = Field(Float)
9779 kshitij.so 508
    serviceTax = Field(Float)
10097 kshitij.so 509
    startDate = Field(DateTime, primary_key=True, autoincrement=False)
510
    expiryDate = Field(DateTime)
9779 kshitij.so 511
    using_options(shortnames=True)
512
    using_table_options(mysql_engine="InnoDB")
513
 
10097 kshitij.so 514
class SourceCategoryPercentage(Entity):
515
    category_id = Field(Integer, primary_key=True, autoincrement=False)
516
    source = Field(Integer, primary_key=True, autoincrement=False)
517
    emiFee = Field(Float)
518
    closingFee = Field(Float)
519
    returnProvision = Field(Float)
520
    commission = Field(Float)
10287 kshitij.so 521
    pgFee = Field(Float)
10097 kshitij.so 522
    competitorCommissionAccessory = Field(Float)
523
    competitorCommissionOther = Field(Float)
524
    serviceTax = Field(Float)
525
    startDate = Field(DateTime, primary_key=True, autoincrement=False)
526
    expiryDate = Field(DateTime)
527
    using_options(shortnames=True)
528
    using_table_options(mysql_engine="InnoDB")
529
 
9884 kshitij.so 530
class MarketPlaceHistory(Entity):
531
    item_id = Field(Integer, primary_key=True, autoincrement=False)
532
    source = Field(Integer, primary_key=True, autoincrement=False)
533
    lowestPossibleTp = Field(Float)
534
    lowestPossibleSp = Field(Float)
535
    ourInventory = Field(Integer)
536
    otherInventory = Field(Integer)
537
    secondLowestInventory = Field(Integer)
538
    ourRank = Field(Integer)
11193 kshitij.so 539
    ourOfferPrice = Field(Float)
540
    ourSellingPrice = Field(Float)
541
    ourTp = Field(Float)
542
    ourNlc = Field(Float)
543
    ourRating = Field(Float)
544
    ourShippingTime = Field(String(10))
9884 kshitij.so 545
    competitionBasis = Field(Integer)
546
    competitiveCategory = Field(Integer)
547
    risky = Field(Boolean)
548
    lowestOfferPrice = Field(Float)
549
    lowestSellingPrice = Field(Float)
11193 kshitij.so 550
    lowestTp = Field(Float)
9884 kshitij.so 551
    lowestSellerName = Field(String(255))
552
    lowestSellerCode = Field(String(255))
11193 kshitij.so 553
    lowestSellerRating = Field(Float)
554
    lowestSellerShippingTime = Field(String(10))
9884 kshitij.so 555
    proposedSellingPrice = Field(Float)
556
    proposedTp = Field(Float)
557
    targetNlc = Field(Float)
558
    salesPotential = Field(Integer)
559
    secondLowestSellerName = Field(String(255))
560
    secondLowestSellerCode = Field(String(255))
561
    secondLowestSellingPrice = Field(Float)
562
    secondLowestOfferPrice = Field(Float)
563
    secondLowestTp = Field(Float)
11193 kshitij.so 564
    secondLowestSellerRating = Field(Float)
565
    secondLowestSellerShippingTime = Field(String(10))
566
    prefferedSellerName = Field(String(255))
567
    prefferedSellerCode = Field(String(255))
568
    prefferedSellerSellingPrice = Field(Float)
569
    prefferedSellerOfferPrice = Field(Float)
570
    prefferedSellerTp = Field(Float)
571
    prefferedSellerRating = Field(Float)
572
    prefferedSellerShippingTime = Field(String(10))
9884 kshitij.so 573
    marginIncreasedPotential = Field(Float)
574
    margin = Field(Float)
575
    competitorEnoughStock = Field(Boolean)
576
    ourEnoughStock = Field(Boolean)
577
    totalSeller = Field(Integer)
578
    avgSales = Field(Float)
579
    decision = Field(Integer)
9909 kshitij.so 580
    reason = Field(String(255))
9949 kshitij.so 581
    run = Field(Integer)
11193 kshitij.so 582
    toGroup = Field(Boolean)
9884 kshitij.so 583
    timestamp =Field(DateTime, primary_key=True, autoincrement=False)
584
    using_options(shortnames=True)
585
    using_table_options(mysql_engine="InnoDB")
11193 kshitij.so 586
 
9884 kshitij.so 587
 
9945 vikram.rag 588
class FlipkartItem(Entity):
589
    item_id = Field(Integer, primary_key=True, autoincrement = False)
590
    exceptionPrice = Field(Float)
591
    warehouseId = Field(Integer)
592
    commissionValue  =  Field(Float)
593
    serviceTaxValue  =  Field(Float)
594
    maxNlc = Field(Float)
595
    skuAtFlipkart = Field(String(255))
596
    isListedOnFlipkart = Field(Boolean)
597
    suppressPriceFeed = Field(Boolean)
598
    suppressInventoryFeed = Field(Boolean)
10097 kshitij.so 599
    flipkartSerialNumber = Field(String(255))
9945 vikram.rag 600
    updatedOn = Field(DateTime)
601
    updatedBy = Field(String(255))
14780 manish.sha 602
    isFaListed = Field(Boolean)
9945 vikram.rag 603
    using_options(shortnames=True)
604
    using_table_options(mysql_engine="InnoDB")
13709 manish.sha 605
 
606
'''    
607
class DealTag(Entity):
608
    id = Field(Integer, primary_key=True, autoincrement = True)
609
    name = Field(String(100))
610
    using_options(shortnames=True)
611
    using_table_options(mysql_engine="InnoDB")
612
 
613
class ItemTag(Entity): 
614
    itemId= Field(Integer, primary_key=True)
615
    tagId = Field(Integer, primary_key=True)
616
    startDate = Field(DateTime)
617
    endDate = Field(DateTime)
618
    status = Field(Boolean)
619
    using_options(shortnames=True)
620
    using_table_options(mysql_engine="InnoDB")
621
'''
622
 
11531 vikram.rag 623
class PrivateDeals(Entity):   
624
    item_id = Field(Integer, primary_key=True, autoincrement = False)
625
    dealFreebieItemId =  Field(Integer)
626
    dealPrice = Field(Float)
627
    startDate = Field(DateTime)
628
    endDate = Field(DateTime)
11566 vikram.rag 629
    dealTextOption = Field(Integer)
11531 vikram.rag 630
    dealText = Field(String(500))
631
    isCod =  Field(Boolean)
632
    rank = Field(Integer)
11566 vikram.rag 633
    dealFreebieOption = Field(Integer)
11606 vikram.rag 634
    isActive = Field(Boolean)
13493 amit.gupta 635
    minLot = Field(Integer)
636
    lotDealPrice = Field(Float)
11531 vikram.rag 637
    using_options(shortnames=True)
638
    using_table_options(mysql_engine="InnoDB")
11816 kshitij.so 639
 
640
class AmazonOutOfSync(Entity):
641
    item_id = Field(Integer, primary_key=True, autoincrement = False)
642
    mfn = Field(Boolean)
643
    fba = Field(Boolean)
644
    fbb = Field(Boolean)
645
    using_options(shortnames=True)
646
    using_table_options(mysql_engine="InnoDB")
11531 vikram.rag 647
 
11905 kshitij.so 648
class PrivateDealsPriceComparison(Entity):
649
    item_id= Field(Integer, primary_key=True, autoincrement=False)
12133 kshitij.so 650
    asin = Field(String(20))
651
    fsn = Field(String(20))
652
    supc = Field(String(20))
11905 kshitij.so 653
    sdPrice = Field(Float)
654
    fkPrice  = Field(Float)
655
    amazonPrice = Field(Float)
656
    dealPrice = Field(Float)
657
    saholicPrice = Field(Float)
658
    lastProcessedTimestamp = Field(DateTime)
659
    using_options(shortnames=True)
660
    using_table_options(mysql_engine="InnoDB")
11531 vikram.rag 661
 
12133 kshitij.so 662
class SourceReturnPercentage(Entity):
663
    source = Field(Integer)
664
    brand = Field(String(100))
665
    category_id = Field(Integer)
666
    returnProvision = Field(Float)
667
    using_options(shortnames=True)
668
    using_table_options(mysql_engine="InnoDB")
12256 kshitij.so 669
 
670
class CompetitorPricingRequest(Entity):
671
    requestId = Field(BigInteger, primary_key=True,autoincrement=False)
672
    user = Field(String(50))
673
    isProcessed = Field(Boolean)
674
    competitorPricing = OneToMany("CompetitorPricing")
675
    using_options(shortnames=True)
676
    using_table_options(mysql_engine="InnoDB")
12243 kshitij.so 677
 
678
class CompetitorPricing(Entity):
679
    item_id = Field(Integer)
680
    snapdealScraping = Field(Boolean)
681
    flipkartScraping = Field(Boolean)
682
    amazonScraping = Field(Boolean)
12256 kshitij.so 683
    ourSnapdealPrice = Field(Float)
684
    ourSnapdealOfferPrice = Field(Float)
685
    ourSnapdealInventory = Field(Integer)
12243 kshitij.so 686
    lowestSnapdealPrice = Field(Float)
12256 kshitij.so 687
    lowestSnapdealOfferPrice = Field(Float)
688
    lowestSnapdealSeller = Field(String(255))
689
    lowestSnapdealSellerInventory = Field(Integer)
690
    ourFlipkartPrice = Field(Float)
691
    ourFlipkartInventory = Field(Integer)
12243 kshitij.so 692
    lowestFlipkartPrice = Field(Float)
12256 kshitij.so 693
    lowestFlipkartSeller = Field(String(255))
15485 kshitij.so 694
    ourAmazonPrice = Field(Float)
12256 kshitij.so 695
    lowestAmazonPrice = Field(Float)
15485 kshitij.so 696
    lowestAmazonSeller = Field(String(255)) 
12256 kshitij.so 697
    competitorPricing = ManyToOne("CompetitorPricingRequest")
12243 kshitij.so 698
    using_options(shortnames=True)
699
    using_table_options(mysql_engine="InnoDB")
12363 kshitij.so 700
 
701
class AmazonPromotion(Entity):
702
    sku = Field(String(20))
703
    standardPrice = Field(Float)
704
    salePrice = Field(Float)
12431 kshitij.so 705
    subsidy = Field(Float)
12363 kshitij.so 706
    startDate = Field(DateTime)
707
    endDate = Field(DateTime)
708
    addedOn = Field(DateTime)
709
    updatedOnMarketplace = Field(DateTime,default = datetime.datetime.strptime('01-01-1970 00:00:00', '%d-%m-%Y %H:%M:%S'),server_default = '1970-01-01')
710
    promotionActive = Field(Boolean)
711
    stateId = Field(Integer)
712
    promotionType = Field(Integer)
713
    using_options(shortnames=True)
714
    using_table_options(mysql_engine="InnoDB")
12133 kshitij.so 715
 
12363 kshitij.so 716
class AmazonScrapingHistory(Entity):
717
    item_id = Field(Integer, primary_key=True, autoincrement=False)
12472 kshitij.so 718
    asin = Field(String(255))
12363 kshitij.so 719
    warehouseLocation = Field(Integer, primary_key=True, autoincrement=False)
12396 kshitij.so 720
    parentCategoryId = Field(Integer)
12363 kshitij.so 721
    ourSellingPrice = Field(Float)
12474 kshitij.so 722
    promoPrice = Field(Float)
12511 kshitij.so 723
    subsidy = Field(Float)
12363 kshitij.so 724
    lowestPossibleSp = Field(Float)
725
    ourRank = Field(Integer)
726
    ourInventory = Field(Integer)
727
    lowestSellerName = Field(String(255))
728
    lowestSellerSp = Field(Float)
12431 kshitij.so 729
    lowestSellerShippingTime = Field(String(10))
730
    lowestSellerRating = Field(String(10))
731
    lowestSellerType = Field(String(20))
12363 kshitij.so 732
    secondLowestSellerName = Field(String(255))
733
    secondLowestSellerSp = Field(Float)
12431 kshitij.so 734
    secondLowestSellerShippingTime = Field(String(10))
735
    secondLowestSellerRating = Field(String(10))
736
    secondLowestSellerType = Field(String(20))
12363 kshitij.so 737
    thirdLowestSellerName = Field(String(255))
738
    thirdLowestSellerSp = Field(Float)
12431 kshitij.so 739
    thirdLowestSellerShippingTime = Field(String(10))
740
    thirdLowestSellerRating = Field(String(10))
741
    thirdLowestSellerType = Field(String(20))
12363 kshitij.so 742
    competitiveCategory = Field(Integer)
12448 kshitij.so 743
    otherCost = Field(Float)
12597 kshitij.so 744
    isLowestMfnIgnored = Field(Boolean)
745
    lowestMfnIgnoredOffer = Field(Float)
746
    isLowestMfn = Field(Boolean)
747
    lowestMfnOffer = Field(Float)
748
    isLowestFba = Field(Boolean)
749
    lowestFbaOffer = Field(Float)
750
    competitivePrice = Field(Float)
751
    cheapestMfnCount = Field(Boolean)
12363 kshitij.so 752
    wanlc = Field(Float)
753
    commission = Field(Float)
754
    competitorCommission = Field(Float)
755
    returnProvision = Field(Float)
12511 kshitij.so 756
    vatRate = Field(Float)
12363 kshitij.so 757
    courierCost = Field(Float)
758
    risky = Field(Boolean)
759
    runType = Field(Integer)
760
    totalSeller = Field(Integer)
761
    ourEnoughStock = Field(Boolean)
762
    marginIncreasedPotential = Field(Float)
763
    avgSale = Field(Float)
764
    multipleListings = Field(Boolean)
12431 kshitij.so 765
    isPromotion = Field(Boolean)
12363 kshitij.so 766
    proposedSp = Field(Float)
767
    proposedTp = Field(Float)
768
    targetNlc = Field(Float)
769
    decision = Field(Integer)
770
    reason = Field(String(255))
12841 kshitij.so 771
    exceptionType = Field(Integer)
12843 kshitij.so 772
    isNlcOverridden = Field(Boolean)
15694 kshitij.so 773
    packagingHeight = Field(Float)
774
    packagingLength = Field(Float)
775
    packagingWidth = Field(Float)
776
    packagingWeight = Field(Float)
777
    isOversized = Field(Boolean)
12363 kshitij.so 778
    timestamp =Field(DateTime, primary_key=True, autoincrement=False)
779
    using_options(shortnames=True)
780
    using_table_options(mysql_engine="InnoDB")
781
 
782
 
12620 amit.gupta 783
class ExclusiveAffiliateItemInfo(Entity):
784
    itemId = Field(Integer, primary_key=True, autoincrement=False)
785
    affiliateId = Field(Integer)
786
    offerText = Field(String(1023))
787
    offerUrl = Field(String(255))
788
    mOfferText = Field(String(1023))
789
    mOfferUrl = Field(String(255))
790
    affiliateSku = Field(String(255))
791
    affiliateUrl = Field(String(255))
792
    addedOn = Field(DateTime)
793
    updatedOn = Field(DateTime)
794
    isActive = Field(Boolean)
795
    using_options(shortnames=True)
796
    using_table_options(mysql_engine="InnoDB")
797
 
798
class OutboundAffiliateMaster(Entity):
799
    id = Field(Integer, primary_key=True, autoincrement=True)
800
    name = Field(String(100))
801
    using_options(shortnames=True)
802
    using_table_options(mysql_engine="InnoDB")
13709 manish.sha 803
 
804
class HsItem(Entity):
805
    hsItemId = Field(String(32), primary_key=True)
806
    itemId = Field(Integer, primary_key=True, autoincrement = False)
807
    hsProductId = Field(String(32))
808
    listingPrice = Field(Float)
809
    defaultWarehouseId = Field(Integer)
810
    addedTimestamp = Field(DateTime)
811
    addedBy = Field(String(100))
812
    using_options(shortnames=True)
813
    using_table_options(mysql_engine="InnoDB")
12620 amit.gupta 814
 
14862 manish.sha 815
class VoiSnapdealItemInfo(Entity):
816
    item_id = Field(Integer, primary_key=True, autoincrement = False)
817
    voiSkuAtSnapdeal = Field(String(255))
818
    sellingPriceSnapdeal = Field(Float)
819
    transferPriceSnapdeal = Field(Float)
820
    fixedMargin = Field(Float)
821
    fixedMarginPercentage = Field(Float)
822
    logisticCostSnapdeal = Field(Float)
823
    woodenPackagingCost = Field(Float)
824
    weightSnapdeal = Field(Float)
19691 manish.sha 825
    using_options(shortnames=True)
826
    using_table_options(mysql_engine="InnoDB")
827
 
14862 manish.sha 828
 
18150 kshitij.so 829
class BulkItemPricing(Entity):
830
    id = Field(Integer, primary_key=True, autoincrement = True)
831
    item_id = Field(Integer, index=True)
832
    quantity = Field(Integer)
833
    price = Field(Float)
834
    using_options(shortnames=True)
835
    using_table_options(mysql_engine="InnoDB")
19691 manish.sha 836
 
837
class ItemWarrantyInfo(Entity):
19714 manish.sha 838
    catalogItemId = Field(Integer, primary_key=True,  autoincrement=False)
19691 manish.sha 839
    itemCondition = Field(Integer, primary_key=True, autoincrement=False)
840
    warrantyVal = Field(Integer)
841
    warrantyPeriodType = Field(String(1))  
842
    using_options(shortnames=True)
843
    using_table_options(mysql_engine="InnoDB")
844
 
845
class CategoryWarrantyInfo(Entity):
846
    categoryId = Field(Integer, primary_key=True, autoincrement=False)
847
    brand = Field(String(100), primary_key=True)
848
    itemCondition = Field(Integer, primary_key=True, autoincrement=False)
849
    warrantyVal = Field(Integer)
850
    warrantyPeriodType = Field(String(1))
851
    using_options(shortnames=True)
852
    using_table_options(mysql_engine="InnoDB")
22249 amit.gupta 853
 
854
class Tag_Listing(Entity):
855
    id = Field(Integer, primary_key=True, autoincrement=False)               
856
    item_id = Field(Integer)
857
    tag_id = Field(Integer)          
858
    selling_price = Field(Float) 
859
    created_by = Field(Integer)
860
    active = Field(Boolean)
861
    start_date = Field(DateTime)
862
    create_timestamp = Field(DateTime)
863
    support_price = Field(Float)
864
    mop = Field(Float)
865
    using_options(shortnames=True)
866
    using_table_options(mysql_engine="InnoDB")
18150 kshitij.so 867
 
22249 amit.gupta 868
 
869
 
870
 
17770 kshitij.so 871
def initialize(dbname='catalog', db_hostname="localhost", setup=True):
746 rajveer 872
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
1122 chandransh 873
    #metadata.bind = 'mysql://root:shop2020@localhost/catalog'
6532 amit.gupta 874
    cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
875
    metadata.bind = cengine
21838 amit.gupta 876
    metadata.bind.echo = True
17770 kshitij.so 877
    setup_all(setup)
115 ashish 878
 
879
if __name__=="__main__":
9242 kshitij.so 880
    initialize()