Check Out GomorraSQL — A Library To Write Queries in Neapolitan
Tags: datascience, database, programming, softwaredevelopment
Published: 2024-01-19 21:09:42

Over the past few days, [GomorraSQL](https://github.com/aurasphere/gomorra-sql)'s been making waves and trending in the Italian IT community. I've read thousands of posts on Twitter and LinkedIn mentioning this project, so I couldn't resist looking into it. Created by [Donato Rimenti](https://github.com/aurasphere), GomorraSQL is inspired by the Italian television series [_Gomorrah_](https://en.wikipedia.org/wiki/Gomorrah_%28TV_series%29) and allows you to query a database in [Neapolitan](https://en.wikipedia.org/wiki/Neapolitan_language).

Although these kinds of projects shouldn't be taken too seriously, they do play a crucial role in the IT community. Let's find out why.

## What Is GomorraSQL?

![GomorraSQL's logo](https://writech.run/wp-content/uploads/2023/08/image-148.png)

First of all, let's try to understand what GomorraSQL is:

> _"GomorraSQL is an easy and straightforward interpreted SQL dialect that allows you to write simpler and more understandable queries in Neapolitan language."_ — [GomorraSQL's GitHub page](https://github.com/aurasphere/gomorra-sql)

As stated in [the official documentation](https://github.com/aurasphere/gomorra-sql), GomorraSQL can be used both as a Java library and as a standalone SQL database client. At the time of writing, the project officially supports only [MySQL](https://www.mysql.com/) and [H2](https://www.h2database.com/html/main.html), but other [RDBMS](https://en.wikipedia.org/wiki/Relational_database#RDBMS) technologies may be added to the list in the future.

## How To Use GomorraSQL

As mentioned earlier, GomorraSQL can be used in two ways. Let's see them both.

### 1\. Java Library

First, download the latest _GomorraSQL.jar_ [from GitHub](https://github.com/aurasphere/gomorra-sql/releases). Then, import it into your project. You will also need a database driver. Now, you can start using GomorraSQL employing the methods exposed by the `GomorraSqlInterpreter` class, which requires a valid [`Connection`](https://docs.oracle.com/en/java/javase/14/docs/api/java.sql/java/sql/Connection.html) object to be instantiated.

`GomorraSqlInterpreter` allows you to either execute a GomorraSQL query against your database or translate queries written in Neapolitan into plain SQL. Please note that whenever an error occurs, a `CaggiaFaException` (literally _WhatShouldIDoException_) providing useful debugging information will be thrown.

### 2\. Database Client

First, download the latest _GomorraSQL.jar_ [from GitHub](https://github.com/aurasphere/gomorra-sql/releases). Then launch it with the following command:

```shell
java -cp gomorra-sql-1.0.0.jar;<path_to_your_db_driver> co.aurasphere.gomorrasql.GomorraSqlShell
```

The client will ask for a JDBC string representing the database to connect to (including credentials). As soon as the connection is established, you can start executing GomorraSQL commands.

## GomorraSQL in Action

Before seeing GomorraSQL in action, you should take a look at these rules:

- Parentheses are not valid characters in GomorraSQL queries.

- GomorraSQL doesn't allow multi-line queries.

- Spacing is required when using operators (e.g. a query including `a = 5` will work, but the same query with `a= 5` or `a =5` or `a=5` will not).

Although I am not a Neapolitan myself, I find writing queries in GomorraSQL to be a fun and wholesome experience. 

Now, it's time to see some GomorraSQL queries compared to their SQL counterparts:

### GomorraSQL

```
1) retrieving all users' data
ripigliammo tutto chillo ch'era 'o nuostro mmiez 'a users
2) retrieving all the emails of the users with id 6 or null name
ripigliammo email mmiez 'a users arò id = 6 o name è nisciun
3) deleting all users' data 
facimm na' strage mmiez 'a users
4) setting the name "Ciro" for all the users
rifacimm users accunza name accussì "Ciro"
5) inserting a new user by setting only their name
nzipp 'ngoppa users name chist "Ciro"
```

### SQL

```
1) retrieving all users' data
SELECT * FROM users
2) retrieving all the emails of the users with id 6 or null name
SELECT * FROM users WHERE id = 6 OR name IS NULL
3) deleting all users' data 
DELETE FROM users
4) setting the name "Ciro" for all the users
UPDATE users SET name = "Ciro"
5) inserting a new user by setting only their name
INSERT INTO users(name) VALUES ("Ciro")
```

Et voilà! You are now ready to start querying your database like a character on _Gomorrah_ would!

## Why Such Projects Are Important

Although you should not expect to use such a library in real-world applications, these projects are more important than they may seem. First, they are apt to go viral. In fact, anyone is willing to reshare them — not only developers. Consequently, they can reach many more people than any other IT project. Second, they are created and maintained for fun, proving the entertaining side of coding.

Both of these points suggest how such fun-based projects can help curious people gain interest in the IT community and engage with it. They may not revolutionize the world or be incredibly forward-looking technologies, but they do play a role in introducing new people to the world of development.

That's why supporting them may be more meaningful than expected.

## Conclusion

In this article, we looked at GomorraSQL, an interpreted SQL dialect allowing you to write queries in Neapolitan. While this cannot be taken too seriously, similar projects play a major role in helping curious people approach and enter the world of coding. This makes these projects more relevant than they may seem — especially considering their ultimate usefulness.

Thanks for reading! I hope that you found this article helpful.
  
***
_The post "[Check Out GomorraSQL — A Library To Write Queries in Neapolitan](https://writech.run/blog/check-out-gomorrasql-a-library-to-write-queries-in-neapolitan-3e85568dddb4/)" appeared first on [Writech](https://writech.run)._