source: mauRepo/MolesManager/trunk/src/MolesManager/dataaccess.py @ 8077

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/MolesManager/dataaccess.py@8280
Revision 8077, 673 bytes checked in by mnagni, 8 years ago (diff)

Refactored the migration process
Now its a periodic task managed by libs.migration.MigrationThread? and is started by the molesSessionMiddleware
Refactored the database connections. Now all rae subclasses of libs.EPB

Line 
1'''
2Created on 3 Nov 2011
3
4@author: mnagni
5'''
6from ea_model.iso_19103_2005_schema_language.basic_types.primitive.date_and_time.date import Date
7from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation
8
9def _buildFilter(key, keyValue):
10    return '%s = \'%s\'' % (key, keyValue)
11
12def doInsert(toStoreInstance, session):
13    session.add(toStoreInstance)
14    session.commit()
15
16def getCEDA_ObservationById(id, session):   
17    res = session.query(CEDA_Observation)
18    print(res)
19    return res.all()
20
21def getDateById(id, session):     
22    res = session.query(Date).filter(*[_buildFilter('date_id', id)])
23    print(res)
24    return res.all()
Note: See TracBrowser for help on using the repository browser.