Пример #1
0
 def x(cls):
     #arrind = func.unnest(cls.indices).label('arrind')
     #x = func.array_agg(arrind / cls.size).label('x')
     s = db.Session()
     arrind = (func.unnest(cls.indices) / cls.size).label('xarrind')
     #x = s.query(arrind).select_from(cls).subquery('xarr')
     #xagg = s.query(func.array_agg(x.c.xarrind))
     return arrind
Пример #2
0
    def cubes(self):
        ''' Get all cubes on this plate '''

        session = db.Session()
        if self.drpver:
            cubes = session.query(Cube).join(PipelineInfo, PipelineVersion).\
                filter(Cube.plate == self.id, PipelineVersion.version == self.drpver).all()
        else:
            cubes = session.query(Cube).filter(Cube.plate == self.id).all()
        return cubes
Пример #3
0
 def y(cls):
     #arrind = func.unnest(cls.indices).label('arrind')
     #x = arrind / cls.size
     #y = func.array_agg(arrind - x*cls.size).label('y')
     #return y
     s = db.Session()
     arrunnest = func.unnest(cls.indices)
     xarr = (func.unnest(cls.indices) / cls.size).label('xarrind')
     arrind = (arrunnest - xarr * cls.size).label('yarrind')
     #n.arrind-(n.arrind/n.size)*n.size
     y = s.query(arrind).select_from(cls).subquery('yarr')
     yagg = s.query(func.array_agg(y.c.yarrind))
     return yagg.as_scalar()
Пример #4
0
import mypkg.SampleModelClasses as sampledb
from sqlalchemy import Column, Integer, ForeignKey
from sqlalchemy.orm import relationship, backref, aliased

import mypkg.DBHelper as sue



from sqlalchemy.orm import aliased
from sqlalchemy import func



import datetime

session = db.Session()

drpalias = aliased(datadb.PipelineInfo, name='drpalias')
dapalias = aliased(datadb.PipelineInfo, name='dapalias')


# Query 1
q1 = session.query(datadb.Cube.mangaid, datadb.Cube.plate, datadb.Cube.plateifu, datadb.IFUDesign.name, dapdb.CleanSpaxelProp5.emline_gflux_ha_6564,
dapdb.CleanSpaxelProp5.x, dapdb.CleanSpaxelProp5.y).join(datadb.IFUDesign,dapdb.File,dapdb.CleanSpaxelProp5).\
filter(dapdb.CleanSpaxelProp5.emline_gflux_ha_6564 > 25).join(drpalias, datadb.Cube.pipelineInfo).\
join(dapalias, dapdb.File.pipelineinfo).filter(drpalias.pk==25).filter(dapalias.pk==26)

start=datetime.datetime.now(); r1 = q1.all(); end=datetime.datetime.now(); td=end-start
print('r1 time', td.total_seconds())
%timeit r1=q1.all()
print('r1 count', len(r1))
Пример #5
0
def doC5Tests(nRuns, logger):


    session = db.Session();
    c5s = [dapdb.CleanSpaxelProp5, suedb.C5SSD, suedb.C5cx, suedb.C5cxSSD, suedb.C5Cstore, suedb.C5CstoreSSD]
Пример #6
0
def doFlatTests(nRuns, logger):
    session = db.Session();


    flats = [suedb.FlatTableTest, suedb.FlatTableSSD, suedb.FlatTableCstore, suedb.FlatTableCstoreSSD]