Subversion Repositories SmartDukaan

Rev

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