[sql lab] fix impersonation + template issue (#3644)
[sql lab] fix impersonation + template issue (#3644)

When the database impersonation flag is on, a query using a template
fails. It has to do with templating using a database connection without
a username being specified by the caller, along with the fact that the
work is taking place on a worker, outside a web request, where
referencing g.user raises this exception.
alanmcruickshank/superset-dev,apache/incubator-superset,zhouyao1994/incubator-superset,timifasubaa/incubator-superset,airbnb/superset,airbnb/superset,airbnb/caravel,zhouyao1994/incubator-superset,airbnb/caravel,dmigo/incubator-superset,airbnb/caravel,alanmcruickshank/superset-dev,zhouyao1994/incubator-superset,alanmcruickshank/superset-dev,apache/incubator-superset,zhouyao1994/incubator-superset,mistercrunch/panoramix,timifasubaa/incubator-superset,apache/incubator-superset,timifasubaa/incubator-superset,mistercrunch/panoramix,airbnb/caravel,alanmcruickshank/superset-dev,apache/incubator-superset,timifasubaa/incubator-superset,apache/incubator-superset,zhouyao1994/incubator-superset,dmigo/incubator-superset,airbnb/superset,mistercrunch/panoramix,mistercrunch/panoramix,dmigo/incubator-superset,dmigo/incubator-superset,airbnb/superset