Example #1
0
 def saveIfNotExists(cls, dev_nonce, device_id, packet_id):
     existing_dev_nonces = session.query(DevNonce).filter(DevNonce.dev_nonce == dev_nonce).filter(DevNonce.device_id == device_id).all()
     if len(existing_dev_nonces):
         prev_packet_id = existing_dev_nonces[0].packet_id
         existing_dev_nonces[0].packet_id = packet_id
         return prev_packet_id
     else:
         DevNonce(
             dev_nonce = dev_nonce,
             device_id = device_id,
             packet_id = packet_id
         ).save()
         session.flush()
         return None
 def save(self):
     session.add(self)
     session.flush()
     session.commit()
Example #3
0
 def save(self):
     session.add(self)
     session.flush()
Example #4
0
 def save_and_flush(self):
     session.add(self)
     session.flush()
Example #5
0
 def save_to_db(self):
     session.add(self)
     session.flush()