Saute corn and onion in the butter over medium high heat for 4 minutes. Cool slightly.
Whisk together milk, half-and-half and eggs. Slowly whisk in cornmeal and ricotta cheese. Add basil, sugar, salt and pepper. Add the corn onion mixture and the grated cheddar cheese. Pour into the greased baking dish. Sprinkle top with additional grated cheese.
Place the baking dish in a larger pan and fill with water half way up the side of the baking dish. Bake for 40 to 45 minutes until a knife inserted in center comes out clean.