logica
logica copied to clipboard
Logica is a logic programming language that compiles to SQL. It runs on Google BigQuery, PostgreSQL and SQLite.
A bit of context: I was translating TPC-H's 10th query, and forgot to put into scope the value of ` l_orderkey` from the `lineitem` table. Logica thus took the `l_orderkey...
Hi, The following code errors out for psql. ``` # Setup # Install Logica. !pip install logica # Install postgresql server. !sudo apt-get -y -qq update !sudo apt-get -y -qq...
```shell %%logica StructureTest @Engine("sqlite"); StructureTest(a: {x: 1, y: 2, z: { w: "hello", v: "world"}}); StructureTest(a: {x: 3, y: 4, z: { w: "bonjour", v: "monde"}}); ``` ``` print(StructureTest['a'].values[0]) print(type(StructureTest['a'].values[0]))...
Hi, Re: the following code in the tutorial. ``` @Engine("sqlite"); AnonymizedCodeContribution(cl_lengths: [110, 220, 405], org: "ads"); AnonymizedCodeContribution(cl_lengths: [30, 51, 95], org: "ads"); AnonymizedCodeContribution(cl_lengths: [10, 20, 1000], org: "games"); HarmonicMean(x) =...
Hi, If I run this, I don't get even numbers. ``` %%logica Even @Engine("sqlite"); Z(x) :- x in Range(20); Even(x) :- Z(x), Z(x / 2); ``` ``` print('Even numbers:', ',...
Most of logica works with PostgreSQL except for the following list: - [x] Output of structures is not supported. E.g. with "psql" engine currently you can't do `Q(contact: {name: "John",...
Spark support would be really nice since it would allow to process big datasets on on-premise deployments.
Functors in Logica are functions that map named tuples of predicates to a predicate. Currently the only available functors are substitutions. Any predicate can work as a functor. External Functors...
I have a table with a STRUCT column, e.g. `STRUCT`. It looks like Logica variables can only be alphanumeric plus underscore. Is there a way to refer to the fields...
It would be great to do a somewhat rigorous analysis of whether there are performance issues when query is written in Logica vs SQL.