How can I use sqlite in appfog? - sqlite

I'm using flask on appfog.com to make a personal blog. Today I tried to use sqlite. I can run the application locally with sqlite but when I update the app to AppFog, it does not seem to work. I can't find how to use sqlite in AppFog's docs. Can anyone tell me?
Thanks...
Sorry for my poor english:-)

It's not recommended to use sqlite for your production apps on AppFog because the file storage is ephemeral. Every time you update your app the database will get blown away. You're better off creating and binding a postgres, mysql, or mongodb database service for your app. You can continue to use sqlite db locally but your production app will use the bound service.
See the Bind Service section of: https://docs.appfog.com/languages/python/flask

Related

How to use Sqlite Database in browser for offline usage

I have developed one application in ionic for offline mode. I have used sqlite database to store the data. Now i want to create a browser build. But sqlite is not supported in browser. Is there any way to use sqlite in browser?
Or else is there any database which works same as sqlite for browser.(kindly do not suggest websql database and pouchdb)
i am using pouchdb for now, but there is lots of redevelopment because queries in pouchdb and sqlite are very different
As of this moment there is no way of using SQLite with ionic in the browser. Did you maybe find a solution to your own problem?
For anyone reading this that wants to purely use SQLite in their app (instead of localstorage) you can use a livereload build on a test device and easily debug and test your code this way. Just connect dev tools and see all the console messages.

How to use sqlite on Heroku

I will like to deploy an app that uses sqlite to Heroku. Googling for how to do this, I come across the official documentation of sqlite on hereku here
And the amazing thing is that, the documentation seems to be suggesting you should not use sqlite on heroku and then went further to tell you how to use Postgres instead!!!
Is it really impossible to use sqlite on heroku and have your data not transient?
Heroku has a database offering of its own, based on the Postgres database so it is necessary to switch so as to avoid the file-based SQlite. To connect to a Heroku database, you will need to use the Heroku CLI. That is the recommendation, as you have noted.
You can run heroku addons:add <your database choice, say the free tier one for example>. It is as simple as that.
If you try to run heroku config:get DATABASE_URL you will notice that a postgres://<> (now postgresql) has been created for you.

Microsoft Azure App services: cannot write to sqlite database

I am trying to deploy my flask app on Microsoft Azure. On the deployed site it can read the db fine, but whenever I try to write to the db, it gives: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) database is locked
My file structure inside the app folder is:
templates
app.py
db.sqlite
However when i run it on my local, everything works fine. Any ideas how I can solve this?
Run from Package makes wwwroot read-only, and you will receive an error when writing files to this directory. You may refer to below links might be helpful:
https://github.com/Azure/app-service-announcements/issues/84
https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package
There is not more information for us to help fixing your issue, such as the necessary code and configuration for using SQLAlchemy with SQLite.
So I suggest that you can carefully refer to the some topics about SQLite locked file for writing.
Database Locking Behavior / Concurrency
The items Client/Server Applications and High Concurrency of the section Situations Where A Client/Server RDBMS May Work Better in the SQLite offical page Appropriate Uses For SQLite.
Meanwhile, some existing SO threads may will help you.
sqlite3.OperationalError: database is locked
SQLAlchemy and SQLite: database is locked
Hope it helps. If you can update your description to post more helpful information, I will try to reproduce your issue and fix it, and then update my post.

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.
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?
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.

Move a remote development database to local usage

I have been using a central MS SQL database located in the cloud to develop a web site project. I have recently found myself in situations, when I need to develop without the internet connection. I want to begin to use a locally available copy of the existing database, put it in App_Data folder.
What is the correct set of steps I need to undertake to get the project to work with local DB?
For example:
Detach a db from an existing SQL instance.
Copy to a development machine.
etc.
Moving a SQL-Server DB is not that hard. Look here for some methods to do it.
http://support.microsoft.com/kb/314546
I usually find the sp_detach + sp_attach method really easy.
I would create an empty shell database locally, then use one of the many schema comparison solutions available to make the local database look exactly like the cloud database.
Correct way is to create and regularly update your standalone copy of database using import/export. In particular MS SQL Server provides Import/Export Wizard tool for such purpose.
Make a backup
Copy backup file
Restore on your server
Restore/organise users

Resources