Open database (.db) file without schema #1701
-
How can I open Database from database file without creating model classes and using raw sql queries to insert, update and also delete data |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
At that point, you may want to consider a separate SQLite library, as you'd not be using any of the WMDB features at all. Unfortunately, SQLite functionality isn't fully exposed like you want in WMDB, although I'd also like to see these features. One challenge is that WMDB does caching, so if you want to execute arbitrary SQL, it'll get complicated. However, there is a way. You can open the DB and define a dummy schema with no migrations and no tables (I think?) and then use the "unsafe" functionality that's not officially documented, to execute queries directly. However, I don't really recommend doing that. |
Beta Was this translation helpful? Give feedback.
At that point, you may want to consider a separate SQLite library, as you'd not be using any of the WMDB features at all. Unfortunately, SQLite functionality isn't fully exposed like you want in WMDB, although I'd also like to see these features. One challenge is that WMDB does caching, so if you want to execute arbitrary SQL, it'll get complicated.
However, there is a way. You can open the DB and define a dummy schema with no migrations and no tables (I think?) and then use the "unsafe" functionality that's not officially documented, to execute queries directly. However, I don't really recommend doing that.