Google often surprises with new projects. First the Fuchsia operating system, and now a new declarative logical programming language, Logica. According to the developers, it is designed to manipulate data and translate programs into SQL language.

Logica will be needed by developers who plan to use logical programming syntax to write database queries. There is now experimental support for executing the resulting SQL code in Google BigQuery storage or in PostgreSQL and SQLite databases.

In fact, Logica is an extension of another data processing language called Yedalog. It is also designed to provide a level of abstraction unavailable in standard SQL. The language is called logical because queries in Logica are programmed in the form of a set of logical statements.

The language supports modules, import operations, and the ability to operate Logica directly from an interactive Jupyter Notebook shell. A practical example is generating a sample of people and names that were mentioned most often in 2020.

The developers of the language say they decided to create it to make life easier for everyone who works with SQL. The problem is that complex SQL queries can be very long and multi-line. At the same time, the contents of such queries are not obvious.

For typical repetitive calculations, SQL has the ability to work with views and functions, but unfortunately they do not support import operations, nor do they provide the flexibility that comes with high-level languages. You can’t transfer a function into a function here, for example.

Logica, on the other hand, provides the ability to link programs from small, clear and reusable logic blocks. They can be tested and linked to specific names, and then grouped into packages that can be used as part of other projects.

The developers have already made a tutorial to introduce the main features and benefits of the new programming language.

You may also like