create account

Hive SQL for Ruby and Rails Applications by inertia

View this thread on: hive.blogpeakd.comecency.com
· @inertia ·
$12.81
Hive SQL for Ruby and Rails Applications
Access [HiveSQL.io](https://hivesql.io) data from your ruby/rails application.

<center><img src="https://files.peakd.com/file/peakd-hive/inertia/In1ZQ9bW-image.png" /></center>

Gem repository: https://github.com/inertia186/hive_sql

### How to Subscribe

**Note:** HiveSQL is a monthly subscription.  To use this gem, you must subscribe to @hivesql and store the credentials as environment variables.

See: https://hivesql.io

### Installation

First, install ruby.  One way to do this is install [rvm](https://rvm.io/install).  Once ruby is installed, install `hive_sql` with the `gem` command:

```bash
gem install hive_sql
```

Or, add it to your `Gemfile`:

```ruby
gem 'hive_sql'
```

### How To Use (Standalone)

```bash
gem install hive_sql
export HIVESQL_HOST=<your hivesql host>
export HIVESQL_USERNAME=<your hivesql username>
export HIVESQL_PASSWORD=<your hivesql password>
hive_sql top upvoted
```

The above example will query the top upvoted content for the last 7 days.

### Models
- Account
- Block
  - Transaction
    - *various operations*
- Comment
- Community
  - Role
  - Subscriber
- Follower
- Reblog
- Tag
- Token
- Witness

### Followers

How to query today's followers:

```ruby
followers = HiveSQL::Tx::Custom::Follow
followers.following(:alice).today.count
```

### Reblog

How to query today's reblogs:

```ruby
reblogs = HiveSQL::Tx::Custom::Reblog
reblogs.author(:alice).today.count
```

### Account Witness Proxy

How to query current accounts that are actively using a proxy:

```ruby
proxied = HiveSQL::Tx::AccountWitnessProxy.active('alice')
proxied.pluck(:account)
```

### Applications

How to query comments by application:

```ruby
comments = HiveSQL::Comment.app('esteem').where(author: 'good-karma')
```

## Get in touch!

If you're using HiveSQL with ruby, I'd love to hear from you.  Drop me a line and tell me what you think!  I'm @inertia on Hive.

Please note that this gem just provides access to the HiveSQL data services are provided by @arcange.

## License

I don't believe in intellectual "property".  If you do, consider the HiveSQL gem as licensed under a Creative Commons CC0 License.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 43 others
properties (23)
authorinertia
permlinkhive-sql-for-ruby-and-rails-applications
categoryhive-146513
json_metadata{"app":"peakd/2020.03.11","format":"markdown","tags":["hivesql","hive","sql","ruby","rails"],"users":["hivesql","inertia","arcange"],"links":["https://hivesql.io","https://github.com/inertia186/hive_sql","/@hivesql","https://hivesql.io","https://rvm.io/install","/@inertia","/@arcange"],"image":["https://files.peakd.com/file/peakd-hive/inertia/In1ZQ9bW-image.png"]}
created2020-03-24 17:54:24
last_update2020-03-24 17:54:24
depth0
children0
last_payout2020-03-31 17:54:24
cashout_time1969-12-31 23:59:59
total_payout_value6.326 HBD
curator_payout_value6.479 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,140
author_reputation346,568,901,399,561
root_title"Hive SQL for Ruby and Rails Applications"
beneficiaries
0.
accountpeakd
weight500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id96,566,547
net_rshares32,998,150,956,043
author_curate_reward""
vote details (107)