Changeset 833 for SHX/trunk


Ignore:
Timestamp:
11/07/12 16:55:51 (8 years ago)
Author:
marcus
Message:

...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/modules/stations.py

    r832 r833  
    262262                tabledata = Base.metadata 
    263263                tabledata.create_all(engine) 
    264  
    265             Session = orm.sessionmaker(bind=engine) 
    266             self.dbsessions[db] = Session() 
     264                Session = orm.sessionmaker(bind=engine) 
     265            else: 
     266                Session = orm.sessionmaker(bind=engine, autoflush=False) 
     267            s = Session() 
     268            if not create: 
     269                # monkey patching *urgs* 
     270                s.flush = saReadonly 
     271            self.dbsessions[db] = s 
    267272 
    268273        try: 
     
    379384    return final 
    380385 
    381 GRA1 = ChannelMeta( 
    382     description=u"GrÀfenberg A1 array station", 
    383     network="GR", 
    384     station="GRA1", 
    385     location="", 
    386     stream="BH", 
    387     component="Z", 
    388     arraycode="GRF", 
    389     latitude=49.691888, 
    390     longitude=11.221720, 
    391     elevation=499.5, 
    392     depth=0, 
    393     offsetx=0.102153, 
    394     offsety=0.109822, 
    395     gain=0.6e9, 
    396     zeros="(0.0,0.0) (0.0,0.0)", 
    397     poles="(-0.037004,0.037016) (-0.037004,-0.037016)", 
    398     start=UTCDateTime("2006-05-10T16:00:00.000"), 
    399 ) 
    400 # GRA1.fir = [FiR(0, "0 1 2 3 4 5 6"), FiR(1, "1 2 3 4 5")] 
     386 
     387def saReadonly(*args, **kwargs): 
     388    """ 
     389    Dummy method for supporting read-only access to SQLite DB 
     390 
     391    http://writeonly.wordpress.com/2009/07/16/simple-read-only-sqlalchemy-sessions/ 
     392    """ 
     393    return 
     394 
    401395 
    402396if __name__ == "__main__": 
Note: See TracChangeset for help on using the changeset viewer.