Skip to content

Commit

Permalink
Format sql query debug message
Browse files Browse the repository at this point in the history
  • Loading branch information
natelust committed Dec 13, 2018
1 parent 88381ab commit 753a3d2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/lsst/daf/butler/registries/sqlPreFlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,14 @@ def selectDimensions(self, originInfo, expression, neededDatasetTypes, futureDat
where = text(expression)
_LOG.debug("full where: %s", where)
q = q.where(where)
_LOG.debug("full query: %s", q)
compiledQuery = q.compile()
queryString = str(compiledQuery)
queryParams = compiledQuery.params
for name, value in queryParams.items():
if isinstance(value, bool):
value = int(value)
queryString = queryString.replace(":"+name, '"{}"'.format(value))
_LOG.debug("full query: %s", queryString)

# execute and return result iterator
rows = self._connection.execute(q).fetchall()
Expand Down

0 comments on commit 753a3d2

Please sign in to comment.