Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

Raw queries support? #1791

Closed ospfranco closed 6 months ago

ospfranco commented 6 months ago

This has been requested before but seems the info is outdated and thought I might ask again. Is there anyway to run raw queries?

The problem I'm having is I need to query a FTS5 virtual table. I don't care about any of the entities. I don't even need to use WatermelonDB for this, the problem if I do it via a raw binding to sqlite is that Watermelon might have a lock on the database and I get a error returned from database: (code: 5) database is locked error. So basically I only care about scheduling the call so that my DB connection does not implode.

I'm also not on React Native, but on Tauri running via Rust bindings to sqlx (actually to the tauri-sql plugin), which means the method described in this issue does not work for my use case.

primus11 commented 6 months ago

Does this maybe help for your case? Unsafe fetch raw

ospfranco commented 6 months ago

I managed to make it work without the use of watermelonDB, at least for now it seems to be working.

@primus11 the link is to the relations docs?

primus11 commented 6 months ago

Must have messed when copying. Glad you found a solution though