// the find
EvgSkv/logica
Logica is a logic programming language that compiles to SQL. It runs on DuckDB, Google BigQuery, PostgreSQL and SQLite.
Logica is a Datalog-family logic programming language and a successor to Google's Yedalog. It compiles programs to SQL and runs them on DuckDB, BigQuery, Postgres, SQLite and a few other engines. It suits people who already keep their data in a SQL engine and want rule-based syntax for queries that get hard to read in SQL, not a general-purpose language.
- The output is ordinary SQL you can read. `logica - print` shows the generated query for any predicate, so when a query is slow or wrong you debug the SQL the engine actually runs, not a runtime you can't see.
- The integration_tests tree pairs each .l program with an expected .txt output and runs them per dialect, including duckdb, psql, trino, presto and clickhouse. For a compiler, that is the regression coverage that matters.
- Aggregation sits in the rule head (`BeersInState(state) += 1`), and `ArgMax5` gives top-k per group in a line or two. The largest-beer-variety example in the README reads top to bottom.
- Engine-specific SQL lives in compiler/dialect_libraries/, one file per engine, which keeps dialect details out of the core rule translator.
- The README's dialect list is out of date. It names BigQuery, Postgres and SQLite and says more engines are coming, but the tree already has DuckDB (which the test suite treats as the default), Trino, Presto, ClickHouse and Databricks support. Someone choosing an engine from the README gets the wrong picture.
- The performance claim is asserted, not shown. 'Magnitudes more powerful' comes with no numbers, and the benchmark work under examples/graph (against Souffle and Cypher) is not linked from the README. Read those before you build a pipeline on it.
- The reference material is thin up front. The README points to a CoLab tutorial and example notebooks, and recursion, negation and aggregation semantics are mostly learned by reading examples. docs/syntax.md exists but the README does not link it.
- Dialect behavior looks maintained by hand. The trino/ and presto/ test folders duplicate the root-level basics, joins and reachability tests with separate expected outputs. A program that passes on one engine can quietly differ on another, and nothing in the layout forces the expected outputs to agree.