create account

RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics by hivetrending

View this thread on: hive.blogpeakd.comecency.com
· @hivetrending ·
$23.54
RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics
## What's RC Angel? 

Last October, I set up my account to donate 10% of its Resource Credits (RC) to [RC-Angel](https://peakd.com/hive-139531/@deathwing/announcing-rc-angel-or-rc-pools-but-better). I have not changed the allocation since. RC angel is a service created by @deathwing that loans out RCs. For example, if a new user has difficulty broadcasting to the network because they've run out of RCs, the angel can step in and give them a resource boost. This service is also hooked up to @rishi556's GiftGiver.site where Hivers can request RC delegations for themselves or others. All of this was made possible by the new RC delegation feature in Hive Hardfork 26 (thanks, core devs!).

## Asking HiveSQL about RC Delegation History

This week I learned how to ask HiveSQL (by @arcange) about Hive custom_json ops. And an interesting question is: how many times has RC angel delegated RCs on my behalf since last October?

A quick query tells me that 412 delegations have been sent from my account.

```
SELECT COUNT(*)
FROM TxCustoms 
WHERE timestamp > DATEADD(MONTH, -6, GETDATE()) 
AND required_posting_auth = 'hivetrending'
AND tid = 'rc'

```

HiveSQL can also do neat tricks like partitioning data into days/months/years buckets. Like this:


```
SELECT DATEPART(month, timestamp) as month_bucket, COUNT(*) as num_rows
FROM TxCustoms 
WHERE timestamp > DATEADD(MONTH, -6, GETDATE()) 
AND required_posting_auth = 'hivetrending'
AND tid = 'rc'
GROUP BY DATEPART(month, timestamp)
ORDER BY month_bucket ASC

```

And then I can copy the data into Google Sheets to make nice charts like this. What happened in Feb?

![image.png](https://files.peakd.com/file/peakd-hive/hivetrending/23sxpXQpkcwzcaWVYdBa3mieX7ELzBKT88Jefz6tbJqeJJXqsjgDTNebYPpNavwnM4JXi.png)

### Calling HiveSQL from VSCode

In the past, I had dabbled with HiveSQL but struggled to find a reliable, free MSSQL client. Look no further! This [VSCode extension](https://learn.microsoft.com/en-us/sql/tools/visual-studio-code/sql-server-develop-use-vscode?view=sql-server-ver16) makes it possible to connect to HiveSQL and execute queries from a VSCode text editor. Awesome!


![image.png](https://files.peakd.com/file/peakd-hive/hivetrending/EoASUqbZkFrmBWVY6TheAQxrtREVfz3qC8KQ5uAEXeaKcqgc86MCpikcN8dVaosyjo6.png)

After installing the VSCode MSSQL extension, many new commands are added to the command palette. First, "MSSQL: Add Connection" and input the connection details provided when signing up for HiveSQL access. Then, create a new file, type an MSSQL query, and run the "MSSQL: Execute Query" command. A new pane will appear on the right with the status and results. 


![image.png](https://files.peakd.com/file/peakd-hive/hivetrending/Eo43mfN9WB3VbRVtP955cq1iY8kCG7DWgXqFEe3N8Qr5HKyEGqpLzvphcD2esU73ChD.png)

## That's it

I just wanted to share a few useful things I've learned this week. Enjoy SQL querying! Consider voting for the [HiveSQL DHF proposal](https://peakd.com/hive-139531/@arcange/hivesql-proposal-2023-2024) and Deathwing's proposal(s) to support their projects.

Signing off,
Hivetrending (pizza.witness team)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 156 others
👎  
properties (23)
authorhivetrending
permlinkrc-angel-delegations-using-vscode--hivesql-to-measure-delegation-metrics
categoryhive-139531
json_metadata"{"app":"peakd/2023.3.3","format":"markdown","description":"How I used HiveSQL to understand rc-angel activity in my account and make a pretty chart.","tags":["rc","hivesql","vscode","mssql","dataanlysis"],"users":["deathwing","rishi556","arcange"],"image":["https://files.peakd.com/file/peakd-hive/hivetrending/23sxpXQpkcwzcaWVYdBa3mieX7ELzBKT88Jefz6tbJqeJJXqsjgDTNebYPpNavwnM4JXi.png","https://files.peakd.com/file/peakd-hive/hivetrending/EoASUqbZkFrmBWVY6TheAQxrtREVfz3qC8KQ5uAEXeaKcqgc86MCpikcN8dVaosyjo6.png","https://files.peakd.com/file/peakd-hive/hivetrending/Eo43mfN9WB3VbRVtP955cq1iY8kCG7DWgXqFEe3N8Qr5HKyEGqpLzvphcD2esU73ChD.png"]}"
created2023-03-23 14:26:45
last_update2023-03-23 14:26:45
depth0
children6
last_payout2023-03-30 14:26:45
cashout_time1969-12-31 23:59:59
total_payout_value11.789 HBD
curator_payout_value11.750 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,108
author_reputation56,528,995,182,801
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id121,896,829
net_rshares45,560,873,305,504
author_curate_reward""
vote details (221)
@hivebuzz ·
Congratulations @hivetrending! You received a personal badge!

<table><tr><td>https://images.hive.blog/70x70/http://hivebuzz.me/badges/birthday-3.png</td><td>Happy Hive Birthday! You are on the Hive blockchain for 3 years!</td></tr></table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@hivetrending) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>


**Check out our last posts:**
<table><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22248%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/248)!
properties (22)
authorhivebuzz
permlinknotify-hivetrending-20230323t202130
categoryhive-139531
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2023-03-23 20:21:30
last_update2023-03-23 20:21:30
depth1
children2
last_payout2023-03-30 20:21:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length883
author_reputation368,400,815,392,432
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,906,544
net_rshares0
@hivetrending ·
Woot! 3 wonderful years!
properties (22)
authorhivetrending
permlinkre-hivebuzz-rrzr2n
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.3.4"}
created2023-03-23 20:47:12
last_update2023-03-23 20:47:12
depth2
children1
last_payout2023-03-30 20:47:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length24
author_reputation56,528,995,182,801
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,907,219
net_rshares0
@arcange ·
Happy Hive Birthday @hivetrending
🎉🎈🎂🎉🎈<div><a href="https://engage.hivechain.app">![](https://i.imgur.com/XsrNmcl.png)</a></div>
properties (22)
authorarcange
permlinkre-1679608235264
categoryhive-139531
json_metadata{"app":"engage"}
created2023-03-23 21:50:36
last_update2023-03-23 21:50:36
depth3
children0
last_payout2023-03-30 21:50:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length129
author_reputation1,065,097,407,310,007
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,909,300
net_rshares0
@hurtlocker ·
$0.23
As someone who struggles with coding, it's really helpful for me when you share these things. I've gotten so much better and you deserve a lot of the credit. Thank you!

!PIZZA
👍  
properties (23)
authorhurtlocker
permlinkre-hivetrending-rs3tcl
categoryhive-139531
json_metadata{"tags":["hive-139531"],"app":"peakd/2023.3.4"}
created2023-03-26 01:26:51
last_update2023-03-26 01:26:51
depth1
children0
last_payout2023-04-02 01:26:51
cashout_time1969-12-31 23:59:59
total_payout_value0.116 HBD
curator_payout_value0.116 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length176
author_reputation8,489,055,796,850
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,969,677
net_rshares417,727,487,565
author_curate_reward""
vote details (1)
@pizzabot ·
<center>PIZZA! 


PIZZA Holders sent <strong>$PIZZA</strong> tips in this post's comments:
@hurtlocker<sub>(1/20)</sub> tipped @hivetrending (x1)


<sub>You can now send $PIZZA tips in <a href="https://discord.gg/hivepizza">Discord</a> via tip.cc!</sub></center>
properties (22)
authorpizzabot
permlinkre-rc-angel-delegations-using-vscode--hivesql-to-measure-delegation-metrics-20230326t012715z
categoryhive-139531
json_metadata"{"app": "pizzabot"}"
created2023-03-26 01:27:15
last_update2023-03-26 01:27:15
depth1
children0
last_payout2023-04-02 01:27:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length262
author_reputation6,182,232,795,106
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id121,969,684
net_rshares0
@poshtoken ·
https://twitter.com/1194664024421519361/status/1638911907003498497
<sub> The rewards earned on this comment will go directly to the people sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.</sub>
properties (22)
authorposhtoken
permlinkre-hivetrending-rc-angel-delegations-using-vscode--hivesql-to-meas636372328
categoryhive-139531
json_metadata"{"app":"Poshtoken 0.0.1","payoutToUser":[]}"
created2023-03-23 14:33:51
last_update2023-03-23 14:33:51
depth1
children0
last_payout2023-03-30 14:33:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length254
author_reputation3,944,596,575,214,909
root_title"RC Angel Delegations: Using VSCode + HiveSQL to Measure Delegation Metrics"
beneficiaries
0.
accountnomnomnomnom
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id121,896,969
net_rshares0