#NEWLINE# def create_generator( self , bdb , table , schema , instantiate ) : #NEWLINE# #INDENT# insert_column_sql = '\n            INSERT INTO bayesdb_nig_normal_column\n                (generator_id, colno, count, sum, sumsq)\n                VALUES (:generator_id, :colno, :count, :sum, :sumsq)\n        ' #NEWLINE# with bdb . savepoint ( ) : #NEWLINE# #INDENT# ( generator_id , column_list ) = instantiate ( schema ) #NEWLINE# for ( colno , column_name , stattype ) in column_list : #NEWLINE# #INDENT# if ( not ( stattype == 'numerical' ) ) : #NEWLINE# #INDENT# raise BQLError ( bdb , ( 'NIG-Normal only supports numerical columns, but %s is %s' % ( repr ( column_name ) , repr ( stattype ) ) ) ) #NEWLINE# #UNINDENT# ( count , xsum , sumsq ) = data_suff_stats ( bdb , table , column_name ) #NEWLINE# bdb . sql_execute ( insert_column_sql , { #NEWLINE# #INDENT# 'generator_id' : generator_id , #NEWLINE# 'colno' : colno , #NEWLINE# 'count' : count , #NEWLINE# 'sum' : xsum , #NEWLINE# 'sumsq' : sumsq , #NEWLINE# #UNINDENT# } )