Skip to content

Tag: sqlite

Django – no such table exception

In Django, I’ve added some models into After makemigrations, migrate raised this exception: So I’ve removed all old migrations and run makemigrations and migrate again which seemed to work. Unfortunately, I’ve noticed that it didn’t helped because when I try to click on User customer profiles of User translator profiles it raises exception: Environment: I’m attaching my

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

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

Change text_factory in Django/sqlite

I have a django project that uses a sqlite database that can be written to by an external tool. The text is supposed to be UTF-8, but in some cases there will be errors in the encoding. The text is from an external source, so I cannot control the encoding. Yes, I know that I could write a “wrapping layer”