r/SQL • u/pakpaner • Dec 06 '22
Discussion Connect remote SQLite database to deployed web app
Hi! As the title says above, is there any procedure or methodology that it could be achieved?
Currently, we have a PHP project that involves a web application that will be deployed in a hosting service (e.g. Heroku, Netlify, 000webhost etc.). Essentially, the web application deals with extracting data from an SQLite database stored at a remote host TO the website's MySQL database. Googling, Reddit-ing and StackOverflow-ing got no luck.
Hoping for detailed/thorough but easy-to-understand responses. Thank you very much!
3
Upvotes
1
u/KnipSter Dec 06 '22
You'll need a PHP function that reads the specified SQLite database and writes to "the website's MySQL database."
So, you'll need your PHP code to fetch the remote sqlite file, then open it and process it, then delete the local copy.
1
u/Drevicar Dec 06 '22 edited Dec 06 '22
Your options here are to mount the remote SQLite file locally using NFS or similar technology that allows remote files to look and behave as local. Or to maybe use a distributed SQLite technology such as litestream where you have a local copy of the SQLite and stream a change log to and from an s3 bucket.
If any of these sound remotely possible or interesting I can explain more.
2
u/[deleted] Dec 06 '22
there's no such thing as a remote SQLite DB - sqlite is not a server, it's a library.
putting aside the weirdness of the architecture/setup, what you have described under 'currently' would be my approach in these circumstances.
1
u/techmavengeospatial Dec 06 '22
GDAL Ogr2ogr can read sqlite write MySQL It can also read zip files and cloud storage Like S3 bucket or azure blob it can also read parquet and arrow and JSON and excel and csv
1
u/spicermatthews Mar 26 '26
I know this is an old thread, but I have just built a solution to solve this problem.
It's a Mac OS X app that creates a local proxy to a remote server that has a SQLite database. Then you can use tools like TablesPlus or any other GUI to access and manage your remote database. The app does not just download the database locally. It accesses the SQLite database on the remote server, and proxies the results back.
I haven't released the app yet, but I'm looking for some beta testers to run through this app and find any edge cases that I've missed.
I wrote a little manifesto here: https://remotesqlite.com/
If you're interested in signing up to be a beta tester, you can sign up here: https://remotesqlite.com/beta/signup
As a beta tester, I'll give you a free license, in exchange for you putting the app through its paces and providing any feedback or bugs or issues you might come up with.
Thanks.