Browse Source

Db connection for Markets.

main
ericssonmarin-cpp 1 year ago
parent
commit
ff071d8b8f
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      MarketPlaces/DB_Connection/db_connection.py

+ 10
- 1
MarketPlaces/DB_Connection/db_connection.py View File

@ -299,7 +299,7 @@ def create_items(cur, row, marketId, vendorId):
"rating_item = %(rating_item)s, dateadded_item = %(dateadded_item)s, btc_item = %(btc_item)s, " \
"usd_item = %(usd_item)s, euro_item = %(euro_item)s, quantitysold_item = %(quantitysold_item)s, " \
"quantityleft_item = %(quantityleft_item)s, shippedfrom_item = %(shippedfrom_item)s, shippedto_item = %(shippedto_item)s, " \
"dateinserted_item = %(dateinserted_item)s where item_id = %(itemId)s"
"lastseen_item = %(lastseen_item)s, dateinserted_item = %(dateinserted_item)s where item_id = %(itemId)s"
cur.execute(sql, {'description_item': row[5] if row[5] != '-1' else None,
'cve_item': row[6] if row[6] != '-1' else None,
@ -317,6 +317,15 @@ def create_items(cur, row, marketId, vendorId):
'shippedfrom_item': row[18] if row[18] != '-1' else None,
'shippedto_item': row[19] if row[19] != '-1' else None,
'dateinserted_item': row[21],
'lastseen_item': row[21],
'itemId': itemId})
else: #updating when was the last time the crawler saw tha item
sql = "Update items set lastseen_item = %(lastseen_item)s where item_id = %(itemId)s"
cur.execute(sql, {'lastseen_item': row[21],
'itemId': itemId})
return itemId


Loading…
Cancel
Save