Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable admins to directly query the OLAP database (resolvers) #6624

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

grahamplata
Copy link
Contributor

@grahamplata grahamplata commented Feb 7, 2025

This Pull Request enables project admins the ability to query their data directly from the rill cli tool. Admins can target resolvers and issue sql queries.

go run ./cli query --sql "select * from auction_data_model" --local --limit 2 --format json
[
  {
    "__time": "2023-09-09T22:00:00Z",
    "ad_position": "Not Available",
    "ad_size": "320x50",
    "app_or_site": "App",
    "app_site_cat": "Arts \u0026 Entertainment",
    "app_site_domain": "Not Available",
    "app_site_name": "FreeCell Solitaire: Card Games",
    "auction_type": "First Price",
    "bid_floor": 0.1218,
    "bid_floor_bucket": "0.10-0.15",
    "bid_request_cnt": 200,
    "device_country": "USA",
    "device_os": "Android",
    "device_osv": "13",
    "device_state": "NH",
    "device_type": "Mobile/Tablet",
    "has_bid_floor_cnt": 1,
    "placement_type": "BANNER",
    "platform_browser": "Chrome Mobile",
    "pub_name": "GG Software",
    "video_max_duration_bucket": "Not Available",
    "video_min_duration_bucket": "Not Available"
  },
  {
    "__time": "2023-09-09T06:00:00Z",
    "ad_position": "Not Available",
    "ad_size": "320x50",
    "app_or_site": "App",
    "app_site_cat": "Not Available",
    "app_site_domain": "Not Available",
    "app_site_name": "Spider Solitaire: Card Games",
    "auction_type": "First Price",
    "bid_floor": 0.425,
    "bid_floor_bucket": "0.40-0.45",
    "bid_request_cnt": 200,
    "device_country": "USA",
    "device_os": "Android",
    "device_osv": "13",
    "device_state": "ME",
    "device_type": "Mobile/Tablet",
    "has_bid_floor_cnt": 1,
    "placement_type": "BANNER",
    "platform_browser": "Chrome Mobile",
    "pub_name": "Singular One",
    "video_max_duration_bucket": "Not Available",
    "video_min_duration_bucket": "Not Available"
  }
]

With jq

go run ./cli query --sql "select * from auction_data_model" --local --limit 2 --format json | jq '.[].app_site_name'
"FreeCell Solitaire: Card Games"
"Spider Solitaire: Card Games"

Helpful for testing ~

  1. Start the local devtool instance go run ./cli devtool start local
  2. Issue queries against the project with the cli go run ./cli query --sql="SELECT 1"
# target of raw source in auction_data_raw.yaml
go run ./cli query --sql "select * from auction_data_raw" --local --limit 1 --format json

# target of raw source in bids_data_model.sql
go run ./cli query --sql "select * from bids_data_model" --local --limit 1 --format json

# Meta Query
go run ./cli query --sql "SHOW ALL TABLES" --local --limit 1 --format json
[
  {
    "column_names": "",
    "column_types": "",
    "database": "auction_data_model__1737736583035__db",
    "name": "auction_data_model",
    "schema": "main",
    "temporary": ""
  }
]

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes https://github.com/rilldata/rill-private-issues/issues/1130
  • Checked if the docs need to be updated - CLI doc gen after Peer Review ~
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

@grahamplata grahamplata self-assigned this Feb 11, 2025
@grahamplata grahamplata marked this pull request as ready for review February 11, 2025 14:20
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.

1 participant