[sql] plumb env vars into queries