Grasp: A New Way to Write SQL

Grasp: A New Way to Write SQL

MySQL meets Jupyter notebooks. Submission for the Planetscale hackathon

·

5 min read

NOTE: This project was built for the Hashnode x Planetscale hackathon.

The problem

Interacting with SQL databases is a crucial skill for developers to acquire. Storing and querying data correctly is an integral part of any software application. And so, it becomes important to learn it properly. However, my teammate and I saw through our own experiences learning SQL, that learning to write proper queries was often a tedious task for our fellow classmates. A big reason for that was the way we were taught.

The tools that many schools or college instructors use to teach SQL can often seem quite overwhelming for a beginner. Add to that, the inability to store and save your queries and their results for reference later. And, of course, the often painful process to get it working on their own personal computers.

When deciding on a project for this hackathon, this problem became our starting point. And we think that the solution we came up with can not only help with all of the aforementioned issues, but can also give even seasoned developers a far better method to write and interact with SQL databases.

Enter, Grasp.

In a sentence, it's like Jupyter notebooks and MySQL had a child. But, it's much more than that:

Grasp provides a unique and easier way to write and learn SQL. With Grasp, we wanted to create a coding notebook-like experience but for executing SQL. The main goal was to make it easy for people to learn SQL, by providing the ability to:

  1. Save the queries and their results.
  2. Share notebooks so that others can view them.
  3. Add Markdown documentation in between code blocks to provide context.

Grasp provides ways to accomplish all that! Here's what a typical Grasp notebook looks like:

Grasp Notebook

Pretty cool, huh? Let's talk some more about Grasp's features.

To each, their own

Every user has the ability to create multiple Grasp notebooks. Each notebook opens up a new database. This ensures that each Grasp SQL notebook has its own set of tables and data, and that there are no nasty overlaps.

Grasp makes it very easy for its users to manage their notebooks. They simply need to sign in and they can then visit the user dashboard to create, view, or edit their notebooks!

Grasp User Dashboard

No more out-of-context code

Grasp being a coding notebook also provides the incredible ability to add Markdown blocks to add useful documentation and give more information on what the queries do.

image.png

This will make it easier for beginners to learn SQL; they can have an explanation of the code and see the results when it runs in one place.

Sharing is caring

Grasp notebooks are shareable. That means that you can create a notebook, run all kinds of queries on it, save the results you get, and share it with a friend or a peer!

Any notebook that others open but do not own, will only have the permission to view it but not edit it, thus, making sure that no one else messes up your stuff!

That's cool and all, but why do I need Grasp?

Good question, Reader!

Here's the answer: Grasp is easy to use and easy to share, and it makes SQL fun. Beginners can use Grasp notebooks to learn and experiment with SQL, and veterans share their code with peers.

If you're a teacher, you can create Grasp notebooks for your students. Add Markdown explanation and then the queries with saved results. With each lesson, you can add more and more stuff - making it easy for your students to revise. And the students, in turn, can create their own notebooks. Take notes, experiment, and save it all for future reference.

If you're a data analyst, you can use SQL's speed and efficiency to explore databases and save your results within the notebook that you can later share with people.

Planetscale

For the database for the notebooks, we used Planetscale's cloud-based MySQL databases. That made it easy for us by taking care of all the cloud management and integrate it into our notebooks. We hope to use Planetscale in our future projects too!

Beyond the hackathon

We aim to make Grasp more than it is; not just harnessing the power of SQL but also amplifying it. We have tons of ideas and we are very excited to implement them all. We really believe that Grasp can make learning SQL more accessible. And that's why my teammate and I have decided to continue building Grasp even after this hackathon.

Here are some of the features that we plan to implement in Grasp:

  1. Data Visualisation: We want to add the ability to visualize and graph the SQL databases. It will enrich the experience of the notebooks and allow people to make more exciting explorations.

  2. Exporting: It'd be cool if users can export their notebooks as PDF files, that way they can even print and share the notebooks - improving the learning experience.

  3. Collaborative Notebooks: We want to make Grasp notebooks collaborative so that members of a team can edit and add to the notebook simultaneously!

  4. Much more!

Grasp is open source, which means that anyone can contribute to the source code and make it even better!

...and, we're done!

That's about it for our submission for the Planetscale hackathon: Grasp. We had a lot of fun coming up with it and building it. There's still work to do and we're excited about it. Participating in this hackathon and getting introduced to Planetscale was an amazing experience. We are happy with what we ended up creating and we hope you found it interesting!

You can check out the GitHub repository for the source code here.

Thank you for reading!:)