I'm trying to use the SOUNDEX function with SQLite. Can I install this with homebrew, or do I need to compile from source?
I've tried
brew install --fresh sqlite --with-functions
which seems to install extension functions, but I still get Error: no such function: SOUNDEX messages on my queries.
I also tried to modify the sqlite formula, adding the following compile option
ENV.append 'CPPFLAGS', "-DSQLITE_SOUNDEX"
based on http://www.sqlite.org/lang_corefunc.html, but this still fails.
Ideally I'd like to avoid compiling SQLite manually from source, even if that means I need to write a custom homebrew formula.
That's the right flag, but you might not be running the right sqlite.
Your approach is correct. Adding that ENV.append 'CPPFLAGS', "-DSQLITE_SOUNDEX" will compile it with soundex. I just tested it with SQLite 3.7.16.2 and homebrew on my OS X 10.8.3 system. Or, for more control, like this.
option 'with-soundex', 'Enable the SOUNDEX function'
def install
[ ... ]
ENV.append 'CPPFLAGS', "-DSQLITE_SOUNDEX" if build.include? "with-soundex"
Are you sure you're calling the right sqlite3 program once it's installed? SQLite is a "keg-only" formula; that is, unlike most homebrew formulas, it does not get linked in to /usr/local/bin, to avoid conflicting with the sqlite supplied with OS X. You need to call the homebrew one with the full path, like /usr/local/Cellar/sqlite/3.7.16.2/bin/sqlite3.
$ /usr/local/Cellar/sqlite/3.7.16.2/bin/sqlite3
SQLite version 3.7.16.2 2013-04-12 11:52:43
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select soundex('Hello, world!');
H464
It would be easy to add a --with-soundex option to the main homebrew sqlite formula, so you don't have to maintain a separate formula. If you think enough people would use it, head on over to the Homebrew issue tracker on GitHub and put in a request for it.
Related
I am trying to use cl-sql for database access to sqlite3.
But I am getting the error
Couldn't load foreign libraries "libsqlite3", "sqlite3". (searched CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS*: (#P"/usr/lib/clsql/" #P"/usr/lib/"))
The same is with sqlite.
I have installed sqlite3 using apt-get and there is a file libsqlite.so.0 in /usr/lib directory.
I also tried to build sqlite3 from source but I couldn't get the so file. What is that I am doing wrong?
Your problem is that cl-sql has a third party dependency. If you inspect the implementation of cl-sql (probably under "~/quicklisp/dists/quicklisp/software/clsql-202011220-git/db-sqlite3/sqlite3-loader.lisp") you will see that the function database-type-load-foreign is trying to load a library named either "libsqlite3" or "sqlite3".
Depending on your operating system this is either looking for a .dll or .so with exactly one of those names.
Given that the version of of libsqlite.so has a different name on your particular distribution of linux, you have a number of different options to make this library work.
Install a version of sqlite3 with the correct binary
Create a soft link to your binary that redirects via ln -s /usr/lib/libsqlite.so.0 /usr/lib/libsqlite3.so (assuming libsqlite.so.0 is the file that clsql is looking for)
Add new paths to CLSQL-SYS:*FOREIGN-LIBRARY-SEARCH-PATHS* to point to the correct binary if it is installed elsewhere (via clsql:push-libary-path)
The Julia Pkg documentation tells how to initiate an environment ($ activate $ENV-NAME), but it probably lacks the handy command to switch to the already created special environment. Also, I'm having trouble finding a command that shows all already created environments on the list, hence, if I have forgotten the names of the environments previously created, I need to do a manual search through the Julia-related folders...
So far, the verbatim help command in Julia REPL provides a poor description and so does the related Pkg-documentation webpage.
Another possible general answer to this predicament is to start using the Playground.jl module, which was recommended here on Medium:
However, the direct download attempt with Pkg repeatedly fails since the Pkg isn't able to find the package in the suggested GH project.
Thanks beforehand for any recommendations.
In package manager prompt just type activate # and press tab-key. The REPLs autocomplete will show you the possible environments.
If you are on a Mac or Linux
you can run this shell command to find all the "enviroment"
bash-3.2$ pwd
/Users/ssiew/juliascript
bash-3.2$ find . -name Project.toml
./Luxordir/Project.toml
./symata/Project.toml
I am trying to update to the latest version of SQLite and when sourcing the package I get error. couldn't find procedure Sqlite3_Init
The version of SQLite that I had before was installed using teacup.
I have tried to follow the steps but I have never really compiled anything really, Any help would be appreciated!
tried compiling sqlite-autoconf-3280000.tar.gz
You've got the right download. The Tcl extension is in the tea folder inside there; the README in that directory has instructions for what to do.
Alternatively, full source distributions of Tcl 8.6 also include SQLite along with a few other extensions (though there's a cut-down source distribution that doesn't).
I want to use sqlite with the json extension so I've installed it with homebrew. When I run which sqlite though, the one that is being used is the anaconda install. If I try and use pythons sqlite library I have the same issue. It's linked to the Anaconda version and the JSON functions aren't available. How do I replace this with the brew version? Brew provided some values when I installed sqlite but I don't know if I need them or how they are used.
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
PKG_CONFIG_PATH: /usr/local/opt/sqlite/lib/pkgconfig
Sqlite installed by Homebrew is keg-only, which is not linked to /usr/local/... .
This is because system already have older version of sqlite3.
If you really want to invoke Homebrew's sqlite binary, specify full path as below.
$ /usr/local/opt/sqlite/bin/sqlite3
(All Homebrew package is symlinked under /usr/local/opt)
I'm not so familiar with python, but AFAIK sqlite is statically linked to python executable.
In other words, maybe you have to build python from source to use with Homebrew's sqlite.
The answer by equal-l2 is correct. Also, the comment under it by Keith John Hutchison.
But, since they are from quite a few years ago and there is not an officially accepted answer still, here you go as this still catches you off-guard in 2022.
To fix, add this to your ~/.zshrc file and you should be good:
export PATH=/usr/local/opt/sqlite/bin:$PATH
Remember to have $PATH at the end like the above and not at the beginning like so:
export PATH=$PATH:/usr/local/opt/sqlite/bin
as the shell traverses your $PATH for command completion left to right and stops at the first instance found and obviously you want your desired path to be considered first.
Also, you might need to run source ~/.zshrc and rehash if you want it to just start working in the same terminal session.
I have a user defined function in SQLite (an aggregator that calculates the product) and it works fine outside R. But I'm on a Mac some of the time, which requires the MacPorts version of SQLite3 if you'd like to add your own functions/extensions.
Can I pick which SQLite3 that RSQLite loads? I don't see anything in the SQLite documentation.
Also, MacPorts appears to change my sqlite3 link to the MacPorts installed SQLite3:
mbp:~ richard$ which sqlite3
/opt/local/bin/sqlite3
But if I want to load the extension in SQLite3, I have to explicitly can the MacPorts version, like this:
mbp:~ richard$ /opt/local/bin/sqlite3 temp.sqlite
Is writing my own SQLite functions and combining them with R a lost cause? Thanks!
Have you installed and loaded the RSQLite.extfuns package? It has a single function which loads the available functions:
db <- dbConnect(SQLite(), dbname = ":memory:")
init_extensions(db)
By default these are the Healy extensions.