def insert_location_data_into_db(location_data):
    location = Location()
    location.location_id = location_data['location_id']
    location.location_name = location_data['location_name']
    location.coordinate = "%s,%s" % (location_data['lat'], location_data['lng'])
    location.location_alias = location_data.get('location_alias')
    location.category_id = location_data['category_id']
    db.session.add(location)
    db.session.commit()
Example #2
0
 def test_location_model(self):
     location = Location()
     location.location_id = 'LOC-123444'
     location.location_name = 'School caffietaria'
     location.coordinate = "6.544443,3.375656"
     location.category_id = '228383838'
     db.session.rollback()
     db.session.add(location)
     self.assertEqual(None, db.session.commit())