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 difficulties 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.
The Logic was created as a concise language that supports the clean and reusable abstraction mechanisms that SQL lacks while supporting modules and imports to solve these challenges.
Logic programming languages solve SQL problems by using the syntax of mathematical propositional Logic rather than the natural English language. The formal logic language was designed by mathematicians specifically to make an 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 link 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 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.