Skip to content

Commit

Permalink
Update big-query.md (#1815)
Browse files Browse the repository at this point in the history
Clarify bigquery example for unique accounts
  • Loading branch information
s-n-park authored Mar 12, 2024
1 parent 55a1029 commit 70eff43
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/bos/queryapi/big-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ The [NEAR Public Lakehouse repository](https://github.com/near/near-public-lakeh

### Example Queries

- _How many unique users do I have for my smart contract per day?_
- _How many unique signers and accounts have interacted with my smart contract per day?_

```sql
SELECT
ra.block_date collected_for_day,
COUNT(DISTINCT t.signer_account_id) as total
COUNT(DISTINCT t.signer_account_id) as total_signers,
COUNT(DISTINCT ra.receipt_predecessor_account_id) as total_accounts
FROM `bigquery-public-data.crypto_near_mainnet_us.receipt_actions` ra
JOIN `bigquery-public-data.crypto_near_mainnet_us.receipt_origin_transaction` ro ON ro.receipt_id = ra.receipt_id
JOIN `bigquery-public-data.crypto_near_mainnet_us.transactions` t ON ro.originated_from_transaction_hash = t.transaction_hash
Expand Down

0 comments on commit 70eff43

Please sign in to comment.