[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding emacsql to NonGNU ELPA?

From: Tim Cross
Subject: Re: Adding emacsql to NonGNU ELPA?
Date: Mon, 03 Jan 2022 23:54:24 +1100
User-agent: mu4e 1.7.5; emacs 28.0.90

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>> Any objections to adding emacsql to NonGNU ELPA?
>>     https://github.com/skeeto/emacsql
> Sure, seems like a good idea to me.  
> ---
> (emacsql db [:select [name id]
>              :from people
>              :where (> salary 62000)])
> ---
> We should probably add something like this to Emacs core, though.  I
> mean the DSL for writing SQL without strings.  I'm not sure this is
> exactly the language we should go for, though, but it generally looks
> sound.

My only concern is the treatment of 1:1 mapping between elisp nil and
sql null. I'm not sure this is a good idea. In database terms, null is
different from nil (or false). In database terms, null essentially means
'unknown' - it isn't false, it isn't true, it is unknown. Most databases
also have a boolean value - perhaps for elisp, false would be a better
mapping for nil than null?

Regardless, I do agree a good DSL for writing SQL which is not simply a
concatenation of strings would be good.

Another approach which I think works well is the HugSQL model where SQL
is parsed into functions. I quite like this approach as it allows you to
write native SQL and then use the HugSQL library to create functions you
can then just call from your Clojure code. Something similar would
probably work well for elisp as well. One reason I like it is that all
other 'high level' mapping of language to SQL or ORM tool has always
imposed too many limits. Many of them work well with very simple basic
data models, but don't scale well once things become more complex. When
using HugSQL, I did not run into this limitation (or at least, ran into
it much later and less frequently :-). At some point, SQL remains the
best way to write database queries in a RDMS).  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]