←back to thread

171 points voat | 1 comments | | HN request time: 0.217s | source
Show context
foobarqux ◴[] No.42159700[source]
There don't seem to be any examples of how to connect to an existing (say sqlite) database even though it says you should try logica if "you already have data in BigQuery, PostgreSQL or SQLite,". How do you connect to an existing sqlite database?
replies(2): >>42161210 #>>42169938 #
1. evgskv ◴[] No.42169938[source]
Yeah, we need better tutorials.

To use SQLite use @Engine("sqlite") imperative. And you can then connect to you database file with @AttachDatabase imperative.

For example if you have example.db file with Fruit table which has col0 column, then you can count fruits with program:

@Engine("sqlite"); @AttachDatabase("example", "example.db");

CountFruit(fruit) += 1 :- Fruit(fruit);

Then run CountFruit predicate.