Comments (5)
EmacSQL is not intended to be used as a general-purpose database interface. See https://github.com/magit/emacsql#faq.
from emacsql.
I understand that, and I guess my question is a bit general. I wonder if this lib can be (should be) used as a default driver for querying SQL DBs, in my case, specifically sqlite.
The built-in Emacs 29 lib makes querying sqlite a breeze.
What's the recommended/idiomatic way of doing it for previous versions of Emacs?
I'm a bit lost trying to understand how emacsql-sqlite, emacssql-sqlite-builtin, emacssql-sqlite-module are related.
Also, I recently set (setq forge-database-connector 'sqlite-builtin)
, but got surprised that I still need to install emacsql-sqlite-builtin
. I'm using the latest Emacs built from --head
, I thought I don't need another package.
Is there a good place to start reading to understand how these packages are related and work with each other?
And again, if someone points to a simple snippet example that queries (any arbitrary) sqlite db in a way that works in both Emacs 29 and older versions - that would be awesome.
from emacsql.
I guess, I'm just gonna use sqlite.el
from emacsql.
I understand that, and I guess my question is a bit general. I wonder if this lib can be (should be) used as a default driver for querying SQL DBs, in my case, specifically sqlite.
Every value read from the database is passed through read
(except NULL
). Unless the database was created using EmacSQL and is only accessed through that, then it is almost certain that read
will throw an error for some values. That's the cause of the error in your case.
The built-in Emacs 29 lib makes querying sqlite a breeze.
What's the recommended/idiomatic way of doing it for previous versions of Emacs?
https://github.com/pekingduck/emacs-sqlite3-api works very similar to the new built-in support, which was inspired by the former.
I'm a bit lost trying to understand how emacsql-sqlite, emacssql-sqlite-builtin, emacssql-sqlite-module are related.
- emacsql-sqlite is the old backend that uses a custom binary.
- emacssql-sqlite-builtin uses the new built-in support and is the future.
- emacssql-sqlite-module is as fast and reliable as the new built-in support, but can be used when stuck on an older Emacs release
Users can choose which backend they want to use, but third-party packages need some boilerplate to actually allow that (see code involving forge-database-connector
for an example).
Also, I recently set
(setq forge-database-connector 'sqlite-builtin)
, but got surprised that I still need to installemacsql-sqlite-builtin
. I'm using the latest Emacs built from--head
, I thought I don't need another package.
By using that setting you are telling EmacSQL that you want to use the backend provided by the emacsql-sqlite-builtin
package, which is a thin wrapper around the new built-in support.
For the time being third-party packages still declare that they depend on emacsql-sqlite
, which was the only SQLite backend that existed when they added that dependency. Unfortunately package.el/elpa does not allow declaring a dependency such as (or emacsql-sqlite emacssql-sqlite-builtin emacssql-sqlite-module)
.
In the future all these backends (or just the two new ones) might be put back into the emacsql
package to make things easier. Other approaches are also still on the table. I won't work on that until January or maybe February.
Is there a good place to start reading to understand how these packages are related and work with each other?
Beyond what I wrote above, I don't think so. I know there is work to be done here, but until I have decided how to do things going forward, I won't write any documentation that might very soon become obsolete.
And again, if someone points to a simple snippet example that queries (any arbitrary) sqlite db in a way that works in both Emacs 29 and older versions - that would be awesome.
It probably would not be hard to write a small wrapper that abstracts the new built-in support and the very similar api provided by
https://github.com/pekingduck/emacs-sqlite3-api.
I guess, I'm just gonna use sqlite.el
A file by that name is part of the new builtin support in Emacs. There also exists a file by the same name in https://gitlab.com/cnngimenez/sqlite.el. To use the latter, you would have to rename it and possibly some functions it defines to remove the conflict.
from emacsql.
A few things I kinda guessed (even before you told them), but now it is all clear. Thank you for the detailed explanation.
from emacsql.
Related Issues (20)
- emacsql-sqlite failing (timeout, still running) on OS X (Big Sur) HOT 14
- 'No EmacSQL SQLite binary available, aborting' after building from master HOT 1
- Update vendored SQLite HOT 2
- "url" and "url-http" seem never used in emacsql-sqlite.el
- "apply: Selecting deleted buffer" when opening a magit buffer (with forge installed) HOT 5
- Comma syntax / How to use :set for multiple columns? HOT 1
- Test failure in emacsql-nul-character on Emacs 25 HOT 1
- MELPA recipe fails without "next" branch HOT 2
- magit-status initially fails with "process emacsql-sqlite no longer connected to pipe; closed it" HOT 4
- emacsql error on install with use package from melpa: Symbol’s value as variable is void: emacsql-sqlite-reserved HOT 5
- Test all back-ends HOT 3
- SQLite binary fails to compile (via spacemacs/magit/forge) HOT 1
- Missing sqlite subdirecotory in melpa HOT 3
- emacsql-process does not return a process on the built-in connection HOT 2
- Preparing to release 4.0.0 HOT 10
- Multi-Word Strings get truncated on output HOT 2
- Uninformative "Selected deleted buffer" error message on emacsql-sqlite failrues
- emacsql probably the cause to freez emacs on macOS HOT 4
- Latest emacsql breaking compatibility with older ( < emacs 29.1) versions HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from emacsql.