Index: trunk/ippToPsps/jython/ipptopspsdb.py
===================================================================
--- trunk/ippToPsps/jython/ipptopspsdb.py	(revision 32250)
+++ trunk/ippToPsps/jython/ipptopspsdb.py	(revision 32261)
@@ -130,4 +130,31 @@
 
     '''
+    Returns a list of processed batch IDs that have not yet been loaded to the ODM
+    '''
+    def getBatchIDsUnloadedToODM(self, epoch, dvoGpc1Label):
+
+        sql = "SELECT DISTINCT batch_id \
+               FROM batch \
+               WHERE timestamp > '" + epoch + "' \
+               AND dvo_db = '" + dvoGpc1Label + "' \
+               AND loaded_to_datastore = 1 \
+               AND loaded_to_ODM = 0"
+
+
+        ids = []
+        try:
+            rs = self.executeQuery(sql)
+            while (rs.next()):
+                ids.append(rs.getInt(1))
+        except:
+            self.logger.exception("Can't query for unloaded batch ids in ipptopsps Db")
+
+        rs.close()
+
+        self.logger.debug("Found %d unloaded items" % len(ids))
+
+        return ids
+
+    '''
     Returns a list of processed batch IDs that have not failed to load and are not yet merged, for this epoch and dvo label
     '''
