Skip to content

Dataset search command APP-7392#11

Merged
ivpusic merged 5 commits into
mainfrom
search_datasets
Mar 4, 2026
Merged

Dataset search command APP-7392#11
ivpusic merged 5 commits into
mainfrom
search_datasets

Conversation

@ivpusic
Copy link
Copy Markdown
Member

@ivpusic ivpusic commented Mar 4, 2026

dune dataset search --query "ethereum transactions" --output json --offset 20

@linear
Copy link
Copy Markdown

linear Bot commented Mar 4, 2026

@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 4, 2026

PR Summary

Cursor Bugbot is generating a summary for commit 560e425. Configure here.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a9d2734d-8ceb-4227-8950-5758c6c8c7b9

📥 Commits

Reviewing files that changed from the base of the PR and between f0b6378 and 3cdc4ba.

📒 Files selected for processing (1)
  • README.md
✅ Files skipped from review due to trivial changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Adds two new top-level CLI commands: dataset (with search) and usage (with date-filtering). Introduces output helper FormatBytes, updates the dune client dependency, adds unit tests for both commands, and registers the new commands in the root CLI.

Changes

Cohort / File(s) Summary
CLI Root
cli/root.go
Registers new dataset and usage subcommands on the root CLI via AddCommand.
Dataset Command
cmd/dataset/dataset.go, cmd/dataset/search.go
Adds dataset parent command and search subcommand. search accepts flags (query, categories, blockchains, dataset-types, schemas, owner-scope, include-private/schema/metadata, limit, offset), builds models.SearchDatasetsRequest, calls client.SearchDatasets, and outputs JSON or a formatted table with pagination.
Dataset Tests
cmd/dataset/search_test.go
Unit tests with a mock client: verifies mapping of flags to request, table output, JSON output, and API error propagation.
Usage Command
cmd/usage/usage.go
Adds usage command with --start-date/--end-date, date validation (YYYY-MM-DD), calls GetUsage or GetUsageForDates, supports JSON or human-readable output and a billing-period table.
Usage Tests
cmd/usage/usage_test.go
Unit tests with mock client: text/JSON outputs, API errors, date-flag forwarding, only-start-date behavior, and invalid-date handling.
Output Helpers
output/output.go
Adds FormatBytes(int64) string to render byte counts as TB/GB/MB/KB/B human-readable strings.
Dependencies
go.mod
Bumps github.com/duneanalytics/duneapi-client-go from v0.4.0 to v0.4.1.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI (dataset search)
    participant Client as duneapi-client-go
    participant API as Dune API

    CLI->>Client: Build SearchDatasetsRequest from flags
    CLI->>Client: client.SearchDatasets(req)
    Client->>API: HTTP request (search datasets)
    API-->>Client: Search response (results, total)
    Client-->>CLI: Return response or error
    CLI-->>CLI: Render JSON or table output
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • duneanalytics/duneapi#934: Adds SearchDatasets API, models, and handlers used by the new dataset search CLI.
  • Search datasets sdk method duneapi-client-go#17: Adds the client method and request/response models (SearchDatasets) consumed by the CLI.

Suggested reviewers

  • va3093
  • norbertdurcansk
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Dataset search command APP-7392' directly matches the main changes: adding a dataset search command to the CLI with various search flags and functionality.
Description check ✅ Passed The description provides a concrete example of the dataset search command with relevant flags (--query, --output, --offset), which aligns with the actual implementation in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Local replace directive accidentally committed in go.mod
    • Removed the local replace directive from go.mod and restored the checksums for the published v0.4.0 version in go.sum by running go mod tidy.

Create PR

Or push these changes by commenting:

@cursor push ece6cd8c2d
Preview (ece6cd8c2d)
diff --git a/go.mod b/go.mod
--- a/go.mod
+++ b/go.mod
@@ -39,5 +39,3 @@
 	golang.org/x/sys v0.37.0 // indirect
 	golang.org/x/text v0.24.0 // indirect
 )
-
-replace github.com/duneanalytics/duneapi-client-go => ../../duneapi-client-go

diff --git a/go.sum b/go.sum
--- a/go.sum
+++ b/go.sum
@@ -29,6 +29,8 @@
 github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/duneanalytics/duneapi-client-go v0.4.0 h1:uK3cCIjhuMl3mGEfNivzj7AoA2H4T6QSgSnIIO4IlWI=
+github.com/duneanalytics/duneapi-client-go v0.4.0/go.mod h1:7pXXufWvR/Mh2KOehdyBaunJXmHI+pzjUmyQTQhJjdE=
 github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
 github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
 github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=

Comment @cursor review or bugbot run to trigger another review on this PR

Comment thread go.mod Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@go.mod`:
- Line 43: Remove the local-path replace in go.mod that pins
github.com/duneanalytics/duneapi-client-go to ../../duneapi-client-go; instead
delete the replace directive so the module resolves from its canonical source
(or update it to a proper versioned module path), ensuring builds are
reproducible and CI/downstream consumers won't fail.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c57758d-9496-4f4e-b04f-3297e56a731c

📥 Commits

Reviewing files that changed from the base of the PR and between f704916 and 560e425.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • cli/root.go
  • cmd/dataset/dataset.go
  • cmd/dataset/search.go
  • cmd/dataset/search_test.go
  • go.mod

Comment thread go.mod Outdated
@ivpusic ivpusic requested a review from va3093 March 4, 2026 09:17
@ivpusic ivpusic merged commit 5eccfa2 into main Mar 4, 2026
1 check passed
@ivpusic ivpusic deleted the search_datasets branch March 6, 2026 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants