Google introduced the open-source Logica programming language this week. It is designed to compile to SQL and run on Google BigQuery with experimental support for PostgreSQL and SQLite. 

According to the company, the language was created to make it easier for developers who have to deal with the challenges of SQL. The challenges with coding using SQL often include constructing statements from long chains of English words and limited support for abstraction. SQL is also rarely tested because testing SQL queries” sounds rather esoteric to most engineers.

To solve these challenges, Logic was created as a concise language that supports the clean and reusable abstraction mechanisms that SQL lacks while supporting modules and imports. 

Logic programming languages solve problems of SQL by using syntax of mathematical propositional logic rather than natural English language. The language of formal logic was designed by mathematicians specifically to make expression of complex statements easier and suits this purpose much better than natural language,” Konstantin Tretyakov and Evgeny Skvortsov from the Logica open-source project wrote in a blog post. “Logica extends classical Logic programming syntax further, most notably with aggregation.”

While SQL operates with relations which are sets of rows, logic programming languages such as Logica, programming the analog of a relation is a predicate and the predicate serves as a logical condition, which describes the rows of a relation, Google explained. 

“Logica brings readability and good engineering practices common for languages like Python, C++, Java etc. to your queries,” according to the project’s tutorial

Users will be able to read queries, re-use sub-queries, test queries, and  the CoLab integration allows users to run single or or multiple (potentially interdependent ) queries and populate Python variables and more. 

An example of how Logica code prioritizes simplicity over SQL for complex queries is available here.