Bogdacutu
Bogdacutu

Reputation: 771

SQLite on Google App Engine

Is it possible to use SQLite as a relational database from Google App Engine? (Java) I need read/write access to it from the app itself.

Also, I am using Quercus for PHP, and if what I am asking for is possible, I can handle storing the database myself.

Upvotes: 2

Views: 1597

Answers (2)

Fedor  Petrov
Fedor Petrov

Reputation: 1050

I know it's a super old question and nothing concerning read-only properties of App Engine has changed since then... But actually you can use sqlite on Google App Engine. There is a writable /tmp directory (https://cloud.google.com/appengine/docs/standard/java-gen2/using-temp-files). 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.

The following problems are connected with this approach:

  1. This directory is "in-memory". So if you want to use really large sqlite file, you may face problems with RAM.
  2. Each node of the app gets its own copy of the database. If you save something on one node, these changes will not be seen by other nodes. And the new data will be lost if the app scales to 0.

Upvotes: 1

Robert Kluin
Robert Kluin

Reputation: 8292

No, it is not possible. This would require write access to the filesystem, which App Engine does not allow.

SQL database support (MySQL like) is planned, but no release data has been given. For now, use the datastore.

Upvotes: 3

Related Questions