Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sqlite: temporary table/view in a read-only db?

It seems that sqlite won't allow me to create a temporary view in a read-only db. Am I missing something? If it's TEMPORARY, I figured db connection mode shouldn't matter.

I even specified "PRAGMA temp_store = MEMORY" -- it didn't help.

Is there a reasonable alternative to using views?

like image 908
noamtm Avatar asked Nov 14 '22 08:11

noamtm


1 Answers

You can create a temporary view that references data in the main db.

CREATE VIEW temp.userview AS select userid, firstname, lastname from main.usertbl;

Then access the view like such...

SELECT * from temp.userview;
like image 156
tidwall Avatar answered Jan 12 '23 14:01

tidwall