dataset.owner is a "synthetic" metadata key, which actually represents the username column of the User row linked by the dataset's owner_id foreign key. The metadata system generates this when constructing the Dataset JSON object as it's useful data, and that's been sufficient to allow selection of ?metadata=dataset.owner.
However, dataset.owner is not a native Dataset column and therefore the key doesn't appear in the ?keysummary output (and isn't selectable for display in the UI), and can't be used either in ?filter or ?sort, which is unfortunate.
This PR adds a join and some minor special casing logic to ensure that the key is reported by ?keysummary, and to allow ?filter=dataset.owner:drb (or likely less useful constructs like ?filter=datset.owner:~dr or even ?filter=dataset.owner:>drb) as well as ?sort=dataset.owner.
While sqlite3 doesn't care, PostgreSQL insists that the sort field be in the SELECT set. Therefore, the datasets list query now returns both Dataset and User objects as a tuple, which the calling code needs to unpack. The changes are luckily minor.
PBENCH-1278
dataset.owner
is a "synthetic" metadata key, which actually represents theusername
column of theUser
row linked by the dataset'sowner_id
foreign key. The metadata system generates this when constructing theDataset
JSON object as it's useful data, and that's been sufficient to allow selection of?metadata=dataset.owner
.However,
dataset.owner
is not a nativeDataset
column and therefore the key doesn't appear in the?keysummary
output (and isn't selectable for display in the UI), and can't be used either in?filter
or?sort
, which is unfortunate.This PR adds a join and some minor special casing logic to ensure that the key is reported by
?keysummary
, and to allow?filter=dataset.owner:drb
(or likely less useful constructs like?filter=datset.owner:~dr
or even?filter=dataset.owner:>drb
) as well as?sort=dataset.owner
.While
sqlite3
doesn't care, PostgreSQL insists that the sort field be in theSELECT
set. Therefore, the datasets list query now returns bothDataset
andUser
objects as a tuple, which the calling code needs to unpack. The changes are luckily minor.