Hi, I might be misunderstanding how reports are meant to work, so I would like to ask before assuming anything is broken.
The reports reference has an example titled "Example: query-based report with CSV export" that uses a data: block with metrics:, together with export: format: csv:
https://docs.rilldata.com/reference/project-files/reports#examples
When I copy that example, the report parses, reconciles and schedules without any error, and the email is delivered. But the download link in the email returns 400:
{"code":3,"message":"unsupported report resolver: metrics"}
The check that rejects it seems to be here:
|
// Get legacy query info back from resolver because currently resolvers does not all options like include headers and also not all resolvers support exports so until then. TODO change UI to support resolver props to open report like alerts |
|
var queryName string |
|
var queryArgsJSON string |
|
var ok bool |
|
if rep.Spec.Resolver != "legacy_metrics" { |
|
return nil, status.Errorf(codes.InvalidArgument, "unsupported report resolver: %s", rep.Spec.Resolver) |
Reading around it, the export path looks older than the resolver abstraction: it rebuilds a legacy query proto from query_name and query_args_json rather than going through Resolver.ResolveExport. And of the resolvers, only sql seems to implement ResolveExport; metrics returns not implemented:
|
func (r *metricsResolver) ResolveExport(ctx context.Context, w io.Writer, opts *runtime.ResolverExportOptions) error { |
|
return errors.New("not implemented") |
|
} |
Is data: meant to support export for reports, so this is a gap that has not been filled yet? Or is query: the only supported way to write a report that delivers a file, in which case the docs example may be worth updating?
Happy to help with a PR if it would be useful, though I am not sure yet whether the right shape is routing downloads through ResolveExport or something else.
Hi, I might be misunderstanding how reports are meant to work, so I would like to ask before assuming anything is broken.
The reports reference has an example titled "Example: query-based report with CSV export" that uses a
data:block withmetrics:, together withexport: format: csv:https://docs.rilldata.com/reference/project-files/reports#examples
When I copy that example, the report parses, reconciles and schedules without any error, and the email is delivered. But the download link in the email returns 400:
The check that rejects it seems to be here:
rill/runtime/server/downloads.go
Lines 78 to 83 in 14296a4
Reading around it, the export path looks older than the resolver abstraction: it rebuilds a legacy query proto from
query_nameandquery_args_jsonrather than going throughResolver.ResolveExport. And of the resolvers, onlysqlseems to implementResolveExport;metricsreturnsnot implemented:rill/runtime/resolvers/metrics.go
Lines 181 to 183 in 14296a4
Is
data:meant to support export for reports, so this is a gap that has not been filled yet? Or isquery:the only supported way to write a report that delivers a file, in which case the docs example may be worth updating?Happy to help with a PR if it would be useful, though I am not sure yet whether the right shape is routing downloads through
ResolveExportor something else.