draft
resource view generation sql
resource views generation code
some cleanup