Created
July 15, 2024 12:14
-
-
Save ianrussel/314db0d1a99705ca23ec03692a899a0f to your computer and use it in GitHub Desktop.
instock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
products_query = db_connector.session.query( | |
DataFeedEbay.legacyitemid, | |
DataFeedEbay.categoryid.label('categoryid'), | |
DataFeedEbay.id.label('datafeed_id'), | |
Product.id.label('product_id'), | |
Product.description, | |
Product.in_stock_status, | |
Product.product_slug_new | |
).join( | |
Product, | |
DataFeedEbay.id == Product.product_id | |
).outerjoin( | |
EBayFirstCheck, | |
Product.id == EBayFirstCheck.product_id | |
).filter( | |
Product.affiliate_store == 'eBay', | |
or_(cast(EBayFirstCheck.status, String) == '200') | |
).filter(or_( | |
Product.primary_category_path.like('gaming%'), | |
Product.primary_category_path.like('computing%') | |
)).order_by( | |
case( | |
(EBayFirstCheck.date_last_checked == None, 0), # noqa | |
else_=1 | |
), | |
EBayFirstCheck.date_last_checked.asc(), | |
Product.modified_at | |
).limit(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment