Created
January 31, 2014 23:40
-
-
Save TallGirlVanessa/8745534 to your computer and use it in GitHub Desktop.
Stored procedure and ORM queries
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
def _trackable_truckload_details(): | |
""" Executes the `ODSQuery.SelectBridgeLoadBoard` stored procedure to retrieve load board details for track-able | |
truckload shipments. | |
Note: This function should only be called once, periodically and the results should be cached. | |
""" | |
return db.session.query( | |
LoadBoard.load, | |
LoadBoard.orgn_stop, | |
LoadBoard.dest_stop, | |
LoadMobileTracking.load_mobile_tracking_id).from_statement( | |
text("EXEC ODSQuery.SelectBridgeLoadBoard")).all() | |
@deprecated | |
def _trackable_truckload_details_orm(): | |
return db.session.query( | |
LoadBoard.load, | |
LoadBoard.orgn_stop, | |
LoadBoard.dest_stop, | |
LoadMobileTracking.load_mobile_tracking_id).outerjoin( | |
(LoadMobileTracking, LoadMobileTracking.load_guid == LoadBoard.load_guid)).filter( | |
LoadBoard.mode == e.LoadMode.TL, | |
LoadBoard.status.in_(( | |
e.LoadStatus.BOOKED, | |
e.LoadStatus.CHECKED_IN, | |
e.LoadStatus.LOADING, | |
e.LoadStatus.PICKED_UP, | |
e.LoadStatus.UNLOADING))).all() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment