Is there an easy way to enable the FTS5 extension for SQLite3 installed with Brew? Some older posts say there should be an install option --with-fts5, however:
$ brew reinstall sqlite3 --with-fts5
...
Error: invalid option: --with-fts5
The fts3_tokenizer is not enabled. I assume there must be an easy way to install/enabled the extension with Brew without compiling from source outside of Brew.
$ sqlite3
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .dbconfig
defensive off
dqs_ddl on
dqs_dml on
enable_fkey off
enable_qpsg off
enable_trigger on
enable_view on
fts3_tokenizer off
legacy_alter_table off
legacy_file_format off
load_extension on
no_ckpt_on_close off
reset_database off
trigger_eqp off
trusted_schema on
writable_schema off
$ brew info sqlite3
sqlite: stable 3.35.5 (bottled) [keg-only]
Command-line interface for SQLite
https://sqlite.org/
/usr/local/Cellar/sqlite/3.35.5 (11 files, 4.2MB)
Built from source on 2021-05-18 at 08:54:33
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/sqlite.rb
...
Try to use CFLAGS environment:
CFLAGS="-DSQLITE_ENABLE_FTS5" brew reinstall sqlite
Edited:
Rebuild to enable fts5 is unnecessary. The sqlite 3.35.5 package is already fts5 module enabled.
$ brew fetch sqlite
...
$ tar xzf ~/Library/Caches/Homebrew/downloads/61d40ad2021e894bcf4c7475eea2dbbfee14c4426b1bbb1816c4055ad1c70b50--sqlite--3.35.5.catalina.bottle.tar.gz -O sqlite/3.35.5/lib/libsqlite3.0.dylib \
| strings - | grep '^fts5: 20\|trigram'
trigram
fts5: 2021-04-19 18:32:05 1b256d97b553a9611efca188a3d995a2fff712759044ba480f9a0c9e98fae886
I wrote you on the trac mailing list too but will post here too.
If you check https://sqlite.org/fts5.html there seems to be a option --enable-fts5 but it also seems disabled by the fault. That said they point to a " amalgamation" (there is a link to it in the page) where you can use this option if you compile the " amalgamation".
Markus
FTS5 is enabled. I was mistaken about the source of the problem I'm experiencing.
>>> import sqlite3
>>> import pprint
>>> db = sqlite3.connect(':memory:')
>>> cursor = db.execute('PRAGMA COMPILE_OPTIONS')
>>> pprint.pprint(cursor.fetchall())
[(u'BUG_COMPATIBLE_20160819',),
(u'COMPILER=clang-12.0.5',),
(u'DEFAULT_CACHE_SIZE=2000',),
(u'DEFAULT_CKPTFULLFSYNC',),
(u'DEFAULT_JOURNAL_SIZE_LIMIT=32768',),
(u'DEFAULT_PAGE_SIZE=4096',),
(u'DEFAULT_SYNCHRONOUS=2',),
(u'DEFAULT_WAL_SYNCHRONOUS=1',),
(u'ENABLE_API_ARMOR',),
(u'ENABLE_COLUMN_METADATA',),
(u'ENABLE_DBSTAT_VTAB',),
(u'ENABLE_FTS3',),
(u'ENABLE_FTS3_PARENTHESIS',),
(u'ENABLE_FTS3_TOKENIZER',),
(u'ENABLE_FTS4',),
(u'ENABLE_FTS5',),
(u'ENABLE_JSON1',),
(u'ENABLE_LOCKING_STYLE=1',),
(u'ENABLE_PREUPDATE_HOOK',),
(u'ENABLE_RTREE',),
(u'ENABLE_SESSION',),
(u'ENABLE_SNAPSHOT',),
(u'ENABLE_SQLLOG',),
(u'ENABLE_STMT_SCANSTATUS',),
(u'ENABLE_UNKNOWN_SQL_FUNCTION',),
(u'ENABLE_UPDATE_DELETE_LIMIT',),
(u'HAS_CODEC_RESTRICTED',),
(u'HAVE_ISNAN',),
(u'MAX_LENGTH=2147483645',),
(u'MAX_MMAP_SIZE=1073741824',),
(u'MAX_VARIABLE_NUMBER=500000',),
(u'OMIT_AUTORESET',),
(u'OMIT_LOAD_EXTENSION',),
(u'STMTJRNL_SPILL=131072',),
(u'THREADSAFE=2',),
(u'USE_URI',)]
I have a SQLite database from which I need to dump a few tables. I created a small script:
$ cat dump.cmd
.output ./layers.sql
.dump layers
.output ./attributes.sql
.dump attributes
.exit
The database file is owned by the user and accessible to sqlite3:
$ ls -laht /home/user/temp/sqlite.db
-rw-r--r--+ 1 user super-users 2,7G 25 jul 10:52 /home/user/temp/sqlite.db
$ sqlite3 /home/user/temp/sqlite.db
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>
The exact location of the database is only known at run time, so the path must be read from an environment variable. This is where things are going wrong:
$ DB_PATH=/home/user/temp/sqlite.db
$ sqlite3 $DB_PATH < dump.cmd
Error: unable to open database "/home/user/temp/sqlite.db": unable to open database file
I tried in a different way with eval but there is the same error:
$ CMD="sqlite3 "$DB_PATH" < dump.cmd"
$ eval `$CMD`
Error: unable to open database "/home/user/temp/sqlite.db": unable to open database file
How can sqlite3 be started with a path from an environment variable?
So I have a sqlite database. My game (C#) is able to open it and run it quite nicely. However, for maintainability and potential conflict reasons, I would like a more manageable format. Our project manager suggested Liquibase. I'm not sure if it's just out of date or what, but it will NOT convert for me, and I'm not sure why. Here's what we got:
running on windows 8.1
liquibase version 3.3.0 (http://www.liquibase.org/download/index.html)
sqlite database made using sqlite manager demo version 4.3.5 (http://www.sqlabs.com/sqlitemanager.php)
java version 8 update 25
sqlite-jdbc-3.8.7 (https://bitbucket.org/xerial/sqlite-jdbc)
The command I enter is...
liquibase --classpath=sqlite-jdbc-3.8.7.jar --driver=org.sqlite.JDBC\
--url="jdbc:sqlite:GameData.sqlite" --changeLogFile=gamedb-canges.xml\
--username=username --password=password generateChangeLog
and the error I get is...
Unexpected error running Liquibase: liquibase.exception.DatabaseException:
liquibase.exception.DatabaseException: java.sql.SQLException: [SQLITE_ERROR]
SQL error or missing database (near ")": syntax error)
I'd try removing the quotes around the URL. You can also include --logLevel=debug on the command line to get better diagnostics.
"SQL error or missing database" is an error message that comes from the SQLite db.
Try to add a full path to the sqlite db like:
--url="jdbc:sqlite:C:\myPath\GameData.sqlite"
i using start terminal
-macbook:sqlTest user1$ sqlite3 sqlTest.sqlite
SQLite version 3.7.13 2012-07-17 17:46:21
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> ATTACH DATABASE 'encrypted.sqlite' AS encrypted KEY 'testkey';
sqlite> SELECT sqlcipher_export('encrypted');
Error: no such function: sqlcipher_export
sqlite>
what makes no such function: sqlcipher_export?
As answered on the mailing list:
The first step is to build the sqlcipher command line tool, as described here:
http://sqlcipher.net/introduction/
Once you have done this, you should run the command like this:
$ ./sqlcipher sqlTest.sqlite
or
$ /full/path/to/sqlcipher/sqlcipher sqlTest.sqlite
On unix systems, if you don't provide an explicit path for a command, the system will look for the program in $PATH. On OSX, the system ships with a sqlite3 command, so you've probably been using that instead of the version compiled with SQLCipher. Please let us know if that resolves the problem. Thanks!
SQLite version 3.8.0.2 2013-09-03 17:11:13
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> $sqlite3 DatabaseName.db;
Error: near "$sqlite3": syntax error
sqlite> DatabaseName.db;
Error: near "DatabaseName": syntax error
sqlite> sqlite3 DatabaseName.db;
Error: near "sqlite3": syntax error
sqlite>
I am trying to create a database in SQLite. I am getting the error as above. Please help
sqlite3 DatabaseName.db is what you'd use at the command line, not once you've already started the shell. Running that at command line will open it in the shell with the empty database already open.
When your prompt is sqlite>, you're already in the shell.
Here are some docs: http://sqlite.org/sqlite.html