#NEWLINE# def __init__( self , manager ) : #NEWLINE# #INDENT# self . manager = manager #NEWLINE# settings = manager . settings #NEWLINE# engine = settings . get ( 'SQLALCHEMYBACKEND_ENGINE' ) #NEWLINE# engine_echo = settings . get ( 'SQLALCHEMYBACKEND_ENGINE_ECHO' ) #NEWLINE# drop_all_tables = settings . get ( 'SQLALCHEMYBACKEND_DROP_ALL_TABLES' ) #NEWLINE# clear_content = settings . get ( 'SQLALCHEMYBACKEND_CLEAR_CONTENT' ) #NEWLINE# models = settings . get ( 'SQLALCHEMYBACKEND_MODELS' ) #NEWLINE# self . engine = create_engine ( engine , echo = engine_echo ) #NEWLINE# self . models = dict ( [ ( name , load_object ( klass ) ) for ( name , klass ) in models . items ( ) ] ) #NEWLINE# if drop_all_tables : #NEWLINE# #INDENT# DeclarativeBase . metadata . drop_all ( self . engine ) #NEWLINE# #UNINDENT# DeclarativeBase . metadata . create_all ( self . engine ) #NEWLINE# self . session_cls = sessionmaker ( ) #NEWLINE# self . session_cls . configure ( bind = self . engine ) #NEWLINE# if clear_content : #NEWLINE# #INDENT# session = self . session_cls ( ) #NEWLINE# for ( name , table ) in DeclarativeBase . metadata . tables . items ( ) : #NEWLINE# #INDENT# session . execute ( table . delete ( ) ) #NEWLINE# #UNINDENT# session . close ( ) #NEWLINE# #UNINDENT# self . _metadata = Metadata ( self . session_cls , self . models [ 'MetadataModel' ] , settings . get ( 'SQLALCHEMYBACKEND_CACHE_SIZE' ) ) #NEWLINE# self . _states = States ( self . session_cls , self . models [ 'StateModel' ] , settings . get ( 'STATE_CACHE_SIZE_LIMIT' ) ) #NEWLINE# self . _queue = self . _create_queue ( settings )