Google has published the logical programming language Logica

Google has introduced a new declarative logical programming language, Logica, designed for data manipulation and translating programs into SQL. This new language is aimed at those who want to use the syntax of logical programming when writing database queries. Currently, the resulting SQL code can be executed in Google BigQuery or in the PostgreSQL and SQLite databases, whose support is still experimental. In the future, there are plans to expand the number of supported SQL dialects. The project's code is written in Python and released under the Apache 2.0 license.

Logica continues the development of another data processing language created at Google, Yedalog, and provides a level of abstraction not available in standard SQL. Queries in Logica are programmed as a set of logical assertions. Modules, import operations, and the ability to use Logica from the Jupyter Notebook interactive shell are supported. For example, to generate a summary of the individuals most frequently mentioned in the news in 2020, the following Logica program can be used to query the GDELT database: @OrderBy(Mentions, "mentions desc"); @Limit(Mentions, 10); Mentions(person:, mentions? += 1) distinct :- gdelt-bq.gdeltv2.gkg(persons:, date:), Substr(ToString(date), 0, 4) == "2020", the_persons == Split(persons, ";"), person in the_persons; $ logica mentions.l run Mentions +β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”-+ | person | mentions_count | +β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”-+ | donald trump | 3077130 | | los angeles | 1078412 | | joe biden | 1054827 | | george floyd | 872919 | | boris johnson | 674786 | | barack obama | 438181 | | vladimir putin | 410587 | | bernie sanders | 387383 | | andrew cuomo | 345462 | | las vegas | 325487 | +β€”β€”β€”β€”β€”-+β€”β€”β€”β€”β€”-+

Writing complex SQL queries leads to the necessity of crafting cumbersome, multi-line strings that are not immediately clear, hindering the reuse of query parts and complicating maintenance. For typical repetitive calculations in SQL, views and functions can be used, but they do not support import operations and lack the flexibility inherent in high-level languages (for example, it is impossible to pass a function into another function). Logica allows you to compose programs from small, understandable, and reusable logical blocks that can be tested, associated with specific names, and grouped into packages available for use in other projects.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers πŸ”₯ Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster