codegen with database