What is HafSQL
It is built to run on HAF and provide gateway to certain data. For example with hafsql, you can query all the operations and virtual operations by their parameters. This includes getting custom_json
operations based on their id
with incredible speed. Or searching transfers based on their memo
. Or having list of incoming delegations.
It is just the matter of what data do you want or need. Then we can add certain indexes to provide that data easily.
On top of that, hafsql-api
is built to provide JSON-RPC 2.0 API access. This again makes it possible to add/manage custom APIs that translate to SQL queries.
Why this post
Although it is fairly "easy" to set up a development environment in 20 minutes and play with HAF and HafSQL, it is not as accessible for everyone. Thus I am providing a public database that is open to anyone. Just remember, this public database is not meant to be used in a production environment in your application.
Play with it and see what data is available and what is not and see how it can help your project. It is possible to add a custom API designed for your needs to hafsql-api
that we can potentially run on all the public RPC nodes. Including rpc.mahdiyari.info
. Check my previous related posts and gitlab for example API calls.
Here are the details for the public HafSQL database.
host: hafsql.mahdiyari.info
port: 5432
database: haf_block_log
user: hafsql_public
password: hafsql_public
This server has been running for couple of months now. There is also a backup server running just in case. There is a 45s timeout on queries. If you hit the timeout it usually means the query is not using an index. You can change your query around, or open an issue, or MR, or reach out to me to potentially add a new index to fit your query if needed.
https://gitlab.com/mahdiyari/hafsql
https://gitlab.com/mahdiyari/hafsql-api
I would also recommend DBeaver as a free database manager.
Thank you for providing a public HAFSQL service. I will use it.
HAF - Hive Application Framework. I just looked up what HAF stands for. Thank you for your post on HAFSQL service. I will read it over and it does give me the novice a bit of insite on what HAF is @mahdiyari Thank you and have a great weekend! Barb !BBH !CTP #ctp
Hi @mahdiyari
This is off-topic: But I was wondering if everything is still OK over there on https://hive.vote/ ?
My @braaiboy account was following @curie ... but 99.9% of my trail votes were for like 1-2% and contributed very little to the author and 0 to my curation... so I disabled it yesterday, but I see I'm still trailing @curie votes.
Thanks in advance.
!LUV
!PIZZA
mahdiyari, braaiboy sent you LUV. 🙂 (2/5) tools | trade | connect | daily
Made with LUV by crrdlx.
Are you sure it is curie and not someone else?
Edit: Asking because I saw your last votes and curie's last votes, they don't match.
I could of course be wrong ;-)... but all signs are pointing that way:
Take this post (https://peakd.com/@player101/buffet-in-seoul-garden) for example. curie voted @ 3.5% and my hive.vote was set at 50% scale and I made a 1.75% vote.
*edit - They won't 100% match, because I have a 95%, I think, VP limit for hive.vote and I use a lot of my VP manually too.
When did you stop the curie?
"Last night"... maybe 8-10 hours ago (realise we might not be in the same time zone :P)
P.S. I see I have you on discord as well, wanna continue the conversation there, so that we don't muddy your OP with off-topic chat?
$PIZZA slices delivered:
@braaiboy(2/10) tipped @mahdiyari
Hi @mahdiyari, Can I ask you for a witness vote please. I am running a witness node, on my private server, hosted here in Adelaide, it would be great to have your support.
Hi @mahdiyari, which driver to choose from this list.
HAF is running on PostgreSQL so choose PostgreSQL
@mahdiyari Sorry , can you help thanks
Select Connect by: Host
Great! I just connected. If there are any SQL query examples or tutorials, I would be very grateful.
Hello @mahdiyari this is really cool.
I already connect with DBeaver, and it's fast!
one question, can we filter the query in
comments_table
for certain language? I'm an absolute noobs for SQL.We don't have a language filter yet. It could be possible but I don't know how accurate it is going to be.
I see. Maybe I could do the language filter on the frontend then. Thanks!
I might add it to hafsql later. Will have to look more into it.