if self._db_connection_provider:
// Serve data from the database.
db = self._db_connection_provider()
cursor = db.cursor()
// Prefetch the tag ID matching this run and tag.
cursor.execute(
"""
SELECT
tag_id
FROM Tags
JOIN Runs USING (run_id)
WHERE
Runs.run_name = :run
AND Tags.tag_name = :tag
AND Tags.plugin_name = :plugin
""",
{"run": run, "tag": tag, "plugin": metadata.PLUGIN_NAME})
row = cursor.fetchone()
if not row:
raise ValueError("No histogram tag %r for run %r" % (tag, run))
(tag_id,) = row
// Fetch tensor values, optionally with linear-spaced sampling by step.