Vertica query script almost done