I am trying to run a Flask REST service on CentOS Apache2 using WSGI. The REST service requires a very small storage. So i decided to use SQLite with sqlite3 python package. The whole application worked perfectly well on my local system and on the CentOS server when ran using app.run(). But when i used WSGI to host the application
Tag: sqlite
“no such table” exception
In Django I added models into models.py. After manage.py makemigrations, manage.py migrate raised this exception: django.db.utils.OperationalError: no such table: auth_test_usertranslatorprofile I removed all old migrations and run makemigrations and migrate again which seemed to work. It didn’t help because when I click User customer profiles of User translator profiles it raises exception: models.py: admin.py: What is the problem? Answer I
Django: Deploying an application on Heroku with sqlite3 as the database
I want to deploy an application with sqlite3 as the database on Heroku. However, it seems to be that Heroku doesn’t support applications with sqlite3 as the database. Is it true? Is there no way to deploy my sqlite3-backed application on Heroku? PS: I have successfully deployed my application using PythonAnywhere, but would now like to know whether there’s any
Use backticks (`) or double quotes (“) with Python and SQLite
I saw a similar question on Stack Overflow pertaining to Android, but I was wondering whether I should use backticks (`) or double quotes (“) – using Python – to select table names or rowid or what have you. I tried single quotes – like this select ‘rowid’, * from ‘tbl’ order by ‘rowid’. The single quotes worked in some
Python Sqlite3 insert operation with a list of column names
Normally, if i want to insert values into a table, i will do something like this (assuming that i know which columns that the values i want to insert belong to): But now i have a list of columns (the length of list may vary) and a list of values for each columns in the list. For example, if i
Sqlite executemany and DELETE
Execute many seems to be very slow with deletion (Insertion is fine) and I was wondering if anyone knows why it takes so long. Consider the code below: And the following time results (timeit was giving funny data so :/) from IPython: And just for the sake of completeness here are the timeit results (but I think timeit is broken
Is there a way to get a list of column names in sqlite?
I want to get a list of column names from a table in a database. Using pragma I get a list of tuples with a lot of unneeded information. Is there a way to get only the column names? So I might end up with something like this: [Column1, Column2, Column3, Column4] The reason why I absolutely need this list
sqlite3.OperationalError: unable to open database file
I get this error when setting up a server in Django. It is sqlite3 which means it should create the .db file but it doesn’t seem to be doing so. I’ve stipulated SQLite as the backend and an absolute file path for where to put it, but no luck. Is this a bug or am I doing something incorrect? (Was
How to convert Python decimal to SQLite numeric?
I have a program that reads financial data in JSON and inserts it into an SQLite database. The problem is when I’m inserting it into SQLite numeric column and it doesn’t seem to like the decimal object. I’ve found this question answered before, but the answer is outdated and from what I understand SQLite now has a currency data type
Aggregating save()s in Django?
I’m using Django with an sqlite backend, and write performance is a problem. I may graduate to a “proper” db at some stage, but for the moment I’m stuck with sqlite. I think that my write performance problems are probably related to the fact that I’m creating a large number of rows, and presumably each time I save() one it’s