Apparently the node red sqlite node does not have the ability to mark a database as write-able? If I attempt to execute say a DROP TABLE query via the node red sqlite node, it fails. Per sqlite this is default behavior unless the database is marked write-able. So request a feature be added to the sqlite node for NR to enable this feature.
Details...
Dropping a table in SQLite requires write access to the database file. If a database is opened in read-only mode, you cannot execute a DROP TABLE statement.
To drop a table, you must open the SQLite database in a writable mode. This is the default behavior when connecting to a database unless specifically specified otherwise (e.g., using mode=ro in the URI or SQLITE_OPEN_READONLY flag).
Example of dropping a table (requires writable connection):
Code
DROP TABLE IF EXISTS my_table;
If you are currently connected in read-only mode and need to drop a table:
Close the read-only connection.
Open a new connection to the database in a writable mode.
In Python with sqlite3:
Python
import sqlite3
conn = sqlite3.connect('your_database.db') # Default is writable
cursor = conn.cursor()
cursor.execute("DROP TABLE IF EXISTS my_table;")
conn.commit()
conn.close()
Using the sqlite3 command-line tool.
Code
sqlite3 your_database.db
DROP TABLE IF EXISTS my_table;
.quit
Execute the DROP TABLE statement and Commit the changes and close the connection.
Important Note: If the database file itself has file system permissions set to read-only, even opening it with a writable flag in SQLite will result in an "attempt to write a readonly database" error. In such cases, you would need to adjust the file system permissions of the database file to allow write access before connecting.