Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open SQLite database on Google App Engine

Is there anyway to open and read a SQLite database file on GAE?

I am currently uploading dbs to blobstore as admin and serving them publicly to user clients. I just can't read them in the GAE admin interface.

like image 440
Jonny Avatar asked Jan 28 '15 04:01

Jonny


2 Answers

You can use SQLITE on Google App Engine. The problem has nothing to do with the support of certain libraries. It has to do with read-only file system. There is, however, a writable /tmp directory. If your app on startup first copies the db.sqlite3 file to /tmp/db.sqlite3 and references this path as database path, it will work.

There are, however, drawbacks. 1. This is not a "real" directory i.e. it's stored im memory. If database is too large, one will get problems. 2. Each instance has its own copy of db.sqlite3 file. Does not scale well.

Here is a django example: Using SQLITE for local Django development for Google App Engine?

like image 196
Fedor Petrov Avatar answered Oct 04 '22 16:10

Fedor Petrov


Short answer, no it is not possible to use a SQLite database on a standard Google App Engine application as it is not currently supported. However, you can give a try at implementing your own configuration with the App Engine Flexible Environment that allows to take advantage of custom libraries through Infrastructure Customization.

In case you would want to experiment, here is a sample Django application designed to be run with its default SQLite database on the App Engine Flexible Environment. Still, make sure to read the database notice providing alternative data storage options and explaining that SQLite data does not persist upon instance restart.

like image 21
Alex Avatar answered Oct 04 '22 15:10

Alex