Add support for saving metadata on queries.

Need to update the docstring. Or not if you take my other suggestion to always save the metadata, in which case this goes away.