uses FIELDS, PKEY, INDEXES and TABLE members to create a sql table for the model

def create_table(clas,pool_or_cursor):
    "uses FIELDS, PKEY, INDEXES and TABLE members to create a sql table for the model"
    def mkfield((name,tp)): return name,(tp if isinstance(tp,basestring) else 'jsonb')
    fields = ','.join(map(' '.join,map(mkfield,clas.FIELDS)))
    base = 'create table if not exists %s (%s'%(clas.TABLE,fields)
    if clas.PKEY: base += ',primary key (%s)'%clas.PKEY
    base += ')'
    commit_or_execute(pool_or_cursor,base)
    clas.create_indexes(pool_or_cursor)