Hi Michel,
The error states that there is no such table finance_transactions  with an s on 
the end.  Maybe you could show us your view code, but that would be the place 
that I would start at.

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Michel Lavoie
Sent: Sunday, October 7, 2018 6:17 AM
To: Django users
Subject: "No such table" error, with different tablename as in query

Hi,

I've just upgrade my Django installation from 1.11 to 2.0, and then to 2.1, and 
am now getting a weird bug with one of my applications. Whenever I try to 
execute a view that either deletes or saves a transation in my "finance" app, I 
get the following error:

OperationalError at /finance/2/1776/delete_transaction/
no such table: main.finance_transactions

The SQL query is fine though, looking at the traceback. It shows the correct 
table name which is: finance_transaction

/srv/http/myserver/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py
 in execute

    def execute(self, query, params=None):
        if params is None:
            return Database.Cursor.execute(self, query)
        query = self.convert_query(query)
        return Database.Cursor.execute(self, query, params)

▼ Local vars
Variable Value
params
(1776,)
query
'DELETE FROM "finance_transaction" WHERE "finance_transaction"."id" IN (?)'
self

<django.db.backends.sqlite3.base.SQLiteCursorWrapper object at 0xb55cf608>

I checked the database and table finance_transaction is present. All views that 
just show data work fine, only the ones that modify data generate this error. 
The other apps from this instance all work 100% fine, only this one has this 
bug. I also didn't modify anything from the code for the Django upgrade, except 
a few changes to views.py and urls.py to turn of warnings.

Any idea what could be causing this? I looked at all lines from the traceback 
and can't see what could be changing the table name after the SQL string get 
created.

BTW, I get the same error from the auto-generated admin page when trying to 
delete a transaction, as well as a custom management script. Thus, it shouldn't 
be related to my views.py.

Thanks,

Michel
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dbdeafaf-1d6c-434e-8ac6-97a57a555e9f%40googlegroups.com<https://groups.google.com/d/msgid/django-users/dbdeafaf-1d6c-434e-8ac6-97a57a555e9f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8195eef3c605409a8a5d7711ad234ba9%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to