|
@@ -282,12 +282,14 @@ class SpApiRequest:
|
|
|
def fba_inventorySQL(self,conn,seller_id):
|
|
|
cursor = conn.cursor()
|
|
|
# 执行语句
|
|
|
- cursor.execute(f"""select asin,sku,seller_id,marketplace_id,country_code,quantity from
|
|
|
- (select * from asj_ads.seller_listings order by update_datetime desc) as t
|
|
|
- where seller_id='{seller_id}' and marketplace_id='{self.marketplace.marketplace_id}'
|
|
|
+ cursor.execute(f""" select asin,sku,seller_id,marketplace_id,country_code,quantity,fulfillment_channel
|
|
|
+ from
|
|
|
+ (select asin,sku,seller_id,marketplace_id,country_code,quantity,fulfillment_channel,
|
|
|
+ ROW_NUMBER() over(partition by asin,sku,seller_id,marketplace_id,country_code order by update_datetime desc) as row_
|
|
|
+ from asj_ads.seller_listings) as t
|
|
|
+ where row_=1 and seller_id='{seller_id}' and marketplace_id='{self.marketplace.marketplace_id}'
|
|
|
and fulfillment_channel='FBA'
|
|
|
- group by asin,sku,seller_id,marketplace_id,country_code,quantity
|
|
|
- """)
|
|
|
+ """)#,quantity
|
|
|
query_ = cursor.fetchall()
|
|
|
col_name = [i[0] for i in cursor.description]
|
|
|
df_datatable = pd.DataFrame(query_, columns=col_name)
|