tshatrov/ichiran

Logging for Postgres queries

mainrs opened this issue · 4 comments

mainrs commented

Hello!

Is it somehow possible to print the queries that the CLI does when segmenting a sentence? I wrote a Rust implementation based on Sqlite and want to verify that I properly query my underlying database.

I have no Lisp experience and reading the source code is really hard for be to be honest...

I believe (setf cl-postgres:*query-log* *standard-output*) will do it. There's also a macro with-log which can be used to wrap a code that performs queries (with-log ("path/to/logfile") ...)

mainrs commented

Ah, so I would have to somehow load the code into a Lisp CLI and run the function, am I right? The CLI does not offer a verbose flag or anything similar to log the queries.

@mainrs Are you planning to share the rust implementation somewhere? I'd love to use it, mainly since it uses sqlite instead of needing postgres.

mainrs commented

At some point, yes. But it is currently a large patchwork and more of a proof of concept. Especially the database conversion from Postgres to Sqlite is super hacky and a lot of manual work. I think porting the parsing logic from LISP to Rust and having some tests to check that the databases actually are the same would be a really good starting point.