Subversion Repositories SmartDukaan

Rev

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