Private Beta
.md

BountyHub Docs

Datasets API and CLI

DatasetService and DatasetViewService RPCs, request and response shapes, pagination, exports, describe, scopes, and the bh dataset commands.

Datasets API and CLI

Datasets are exposed through two ConnectRPC services:

  • bountyhub.dataset.v1.DatasetService — datasets, ingest, SQL, describe, export.
  • bountyhub.dataset.v1.DatasetViewService — saved views.

The generated TypeScript SDK exposes datasetClient and datasetViewClient; the bh CLI wraps the most common DatasetService calls. In Connect JSON, int64 and uint64 fields (for example rowCount) are encoded as strings.

#Authentication and scopes

AccessScope
Get, list, query, project-wide query, describe, export, execute viewDatasetRo
Create, update, delete, ingest, delete rows, clear, create/update/delete viewDatasetRw

Create a Personal Access Token with the Datasets scope (and Projects read, which it requires). See Personal Access Token scopes.

#DatasetService

RPCPurposePagination
CreateDatasetCreate a table and schema—
GetDatasetRead one dataset—
ListDatasetsList project datasetsDefault 50, max 500
UpdateDatasetChange name or description—
DeleteDatasetDelete the dataset and its files—
IngestDatasetRowsAppend observations—
DeleteDatasetRowsSoft- or hard-delete records selected by a filter—
ClearDatasetRemove every record and stored file—
QueryDatasetOne read-only SELECT over datasetDefault 100, max 1,000
QueryDatasetsOne SELECT over every dataset in a projectDefault 100, max 1,000
DescribeDatasetNull/distinct counts and top values—
ExportDatasetStream a full query result to a file—

#CreateDataset

json

Returns { "id": "<dataset-uuid>" }. Names must be unique per project, sharing one case-insensitive namespace with saved views; up to 100 datasets are allowed. See Schemas and identity.

#IngestDatasetRows

json
  • fields is keyed by column name; the service maps values by schema order.
  • Missing fields become NULL; a NULL in a non-nullable column fails.
  • Values must match the column kind (see Structured filters for the value shape).
  • mode is DATASET_INGEST_MODE_UPSERT (default) or DATASET_INGEST_MODE_SYNC.
  • Returns { "rowCount": "<n>" }.

#DeleteDatasetRows

json

filter is required and selects records from the current logical state. DATASET_DELETE_MODE_SOFT appends tombstones and requires identity columns; DATASET_DELETE_MODE_HARD removes the matching observations from stored files. Returns { "deletedRowCount": "<n>", "storageDeltaBytes": "<signed bytes>" }.

#ClearDataset

json

Removes every record and stored file. Returns { "deletedRowCount": "<n>", "storageDeltaBytes": "<negative bytes>" }.

#QueryDataset

json
FieldMeaning
sqlOne read-only SELECT; a bare SELECT * becomes SELECT * FROM dataset.
pageSizeDefault 100, max 1,000.
pageTokenCursor from nextPageToken.
includeHistoryQuery raw observations instead of current state.
ingestedAtFrom / ingestedAtToBound __ingested_at.
filterTyped filter tree; see Structured filters.

The response contains schema.columns, rows (values in schema order), and nextPageToken.

#QueryDatasets

json

Returns { "result": { "columns", "rows", "nextPageToken" } }. Filter with the SQL WHERE clause; the per-relation filters field is reserved and not supported by the current execution path. This path has no history mode. Project-wide SQL is API-only; the Hub UI's SQL box is scoped to one dataset.

#DescribeDataset

json

Returns one entry per schema column with:

FieldMeaning
nullCountRows where the column is NULL.
distinctCountDistinct non-null values.
topValuesUp to 10 most frequent non-null values, most frequent first.

bh dataset describe prints the first three top values.

#ExportDataset

json
FormatEnumContent type
CSVDATASET_EXPORT_FORMAT_CSVtext/csv
JSON LinesDATASET_EXPORT_FORMAT_JSONLapplication/x-ndjson
JSON arrayDATASET_EXPORT_FORMAT_JSONapplication/json
  • sql is required; use SELECT * FROM dataset for a full export.
  • Filters and time bounds use the same outer semantics as QueryDataset.
  • Exports have no page size or row cap; rows stream to the file.
  • The response returns url (presigned, valid for 15 minutes), fileName, contentType, rowCount, and sizeBytes.

#DatasetViewService

RPCScopeNotes
CreateDatasetViewDatasetRwValidates SQL, references, and cycles.
GetDatasetViewDatasetRoReturns valid and invalidReason.
ListDatasetViewsDatasetRoDefault 50, max 500.
UpdateDatasetViewDatasetRwChanges name, description, and SQL; resets validity.
DeleteDatasetViewDatasetRwInvalidates dependent views.
ExecuteDatasetViewDatasetRoDefault 100, max 10,000.

ExecuteDatasetView returns { "result": { "columns", "rows", "nextPageToken" } }. Views run over the current state and have no filter, history, or time-range fields; see Saved views.

#bh CLI

The CLI wraps DatasetService for the common read and manage paths:

bash

bh dataset query prints a next page token line when more rows are available and accepts --page-size (default 100). It has no page-token flag; use the API (QueryDataset) to continue past the first page.

There are no CLI commands for project-wide SQL, saved views, exports, or row ingestion — use the API for those.

#Errors

Connect codeCause
UNAUTHENTICATEDMissing or invalid token.
PERMISSION_DENIEDThe PAT lacks DatasetRo / DatasetRw.
NOT_FOUNDUnknown dataset or view, or one outside the caller's projects.
ALREADY_EXISTSDataset name already used in the project.
INVALID_ARGUMENTInvalid schema, SQL, filter, id, or page token; a view cannot be evaluated.
RESOURCE_EXHAUSTEDToo many concurrent queries or too many per minute.