Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions go/cmd/dataset.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ var datasetGetCmd = &cobra.Command{
}

if output.EffectiveFmt(GCtx) == "json" {
pc := ""
if ds.PartitionColumn != nil {
pc = ds.PartitionColumn.Name
}
item := map[string]string{
"id": ds.ID,
"name": ds.Name,
Expand All @@ -217,7 +221,7 @@ var datasetGetCmd = &cobra.Command{
"status": ds.DataQualityStatus,
"checks": fmt.Sprintf("%.0f", ds.Checks),
"incidents": fmt.Sprintf("%.0f", ds.Incidents),
"partitionColumn": ds.PartitionColumn,
"partitionColumn": pc,
"updated": ds.LastUpdated,
"cloudUrl": ds.CloudURL,
}
Expand All @@ -235,8 +239,12 @@ var datasetGetCmd = &cobra.Command{
}
fmt.Printf(" %-22s %.0f\n", output.Bold.Render("Checks"), ds.Checks)
fmt.Printf(" %-22s %.0f\n", output.Bold.Render("Incidents"), ds.Incidents)
if ds.PartitionColumn != "" {
fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), ds.PartitionColumn)
if ds.PartitionColumn != nil && ds.PartitionColumn.Name != "" {
label := ds.PartitionColumn.Name
if ds.PartitionColumn.ColumnType != "" {
label = fmt.Sprintf("%s (%s)", ds.PartitionColumn.Name, ds.PartitionColumn.ColumnType)
}
fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), label)
}
if len(ds.Tags) > 0 {
fmt.Printf(" %-22s %s\n", output.Bold.Render("Tags"), strings.Join(ds.Tags, ", "))
Expand Down Expand Up @@ -357,8 +365,12 @@ var datasetTimePartitionCmd = &cobra.Command{
}
fmt.Printf(" %-22s %s\n", output.Bold.Render("Dataset"), ds.Name)
fmt.Printf(" %-22s %s\n", output.Bold.Render("ID"), output.Dim.Render(ds.ID))
if ds.PartitionColumn != "" {
fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), ds.PartitionColumn)
if ds.PartitionColumn != nil && ds.PartitionColumn.Name != "" {
label := ds.PartitionColumn.Name
if ds.PartitionColumn.ColumnType != "" {
label = fmt.Sprintf("%s (%s)", ds.PartitionColumn.Name, ds.PartitionColumn.ColumnType)
}
fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), label)
} else {
fmt.Printf(" %-22s %s\n", output.Bold.Render("Partition column"), output.Dim.Render("not set"))
}
Expand Down
9 changes: 8 additions & 1 deletion go/internal/api/datasets.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,17 @@ type DatasetDetail struct {
Datasource DatasourceProperties `json:"datasource"`
Tags []string `json:"tags"`
LastUpdated string `json:"lastUpdated"`
PartitionColumn string `json:"partitionColumn"`
PartitionColumn *PartitionColumnInfo `json:"partitionColumn"`
Owners []DatasetOwnerInfo `json:"owners"`
}

// PartitionColumnInfo is the shape returned by GET /api/v1/datasets/{id} for
// time-partitioned datasets: {name, columnType}. nil when unpartitioned.
type PartitionColumnInfo struct {
Name string `json:"name"`
ColumnType string `json:"columnType"`
}

type DatasetOwnerInfo struct {
Type string `json:"type"`
UserID string `json:"userId"`
Expand Down