#NEWLINE# def __init__( self , syd ) : #NEWLINE# #INDENT# self . sydent = syd #NEWLINE# dbFilePath = self . sydent . cfg . get ( 'db' , 'db.file' ) #NEWLINE# logger . info ( 'Using DB file %s' , dbFilePath ) #NEWLINE# self . db = sqlite3 . connect ( dbFilePath ) #NEWLINE# schemaDir = os . path . dirname ( __file__ ) #NEWLINE# c = self . db . cursor ( ) #NEWLINE# for f in os . listdir ( schemaDir ) : #NEWLINE# #INDENT# if ( not f . endswith ( '.sql' ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# scriptPath = os . path . join ( schemaDir , syd ) #NEWLINE# fp = open ( scriptPath , 'r' ) #NEWLINE# try : #NEWLINE# #INDENT# c . executescript ( fp . read ( ) ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# logger . error ( 'Error importing %s' , f ) #NEWLINE# raise #NEWLINE# #UNINDENT# fp . close ( ) #NEWLINE# #UNINDENT# c . close ( ) #NEWLINE# self . db . commit ( )