Is there a way to force Web2py to see that table is already deleted? When
I try to re-create, I get: <class 'sqlite3.OperationalError'> table
PostalCode already exists
I ran db.PostalCode.drop() in shell
I commented out db.py lines that create the table
I deleted physical file from Windows databases directory
I un-commented db.py lines that create the table
then when try to create table again, I get : <class
'sqlite3.OperationalError'> table PostalCode already exists
thanks,
Alex Glaros
<class 'sqlite3.OperationalError'> table PostalCode already exists Version
web2py™ Version 2.12.2-stable+timestamp.2015.08.09.14.29.44 Python Python
2.7.9: C:\Program Files (x86)\web2py\web2py.exe (prefix: ) Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
Traceback (most recent call last):
File "C:\Program Files (x86)\web2py\gluon\restricted.py", line 227, in
restricted
exec ccode in environment
File "C:/Program Files (x86)/web2py/applications/backupES/models/db.py"
<http://127.0.0.1:8000/admin/default/edit/backupES/models/db.py>, line 499, in
<module>
Field('postal_code_comment','string', comment='this field created by
Engagement Squared'))
File "C:\Program Files (x86)\web2py\gluon\packages\dal\pydal\base.py", line
817, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "C:\Program Files (x86)\web2py\gluon\packages\dal\pydal\base.py", line
856, in lazy_define_table
polymodel=polymodel)
File "C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py", line 463, in
create_table
self.create_sequence_and_triggers(query,table)
File "C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1307, in
create_sequence_and_triggers
self.execute(query)
File "C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1326, in execute
return self.log_execute(*a, **b)
File "C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py", line 1320, in
log_execute
ret = self.cursor.execute(command, *a[1:], **b)
OperationalError: table PostalCode already exists
Error snapshot [image: help]
<http://127.0.0.1:8000/admin/default/ticket/backupES/127.0.0.1.2015-09-27.10-28-21.9e8f171a-7421-4dae-aba5-9ec48a58d004#>
<class 'sqlite3.OperationalError'>(table PostalCode already exists)
inspect attributes
Frames
-
*File C:\Program Files (x86)\web2py\gluon\restricted.py in restricted at
line 227* code arguments variables
-
*File C:\Program Files (x86)\web2py\applications\backupES\models\db.py
in <module> at line 499* code arguments variables
-
*File C:\Program Files (x86)\web2py\gluon\packages\dal\pydal\base.py in
define_table at line 817* code arguments variables
-
*File C:\Program Files (x86)\web2py\gluon\packages\dal\pydal\base.py in
lazy_define_table at line 856* code arguments variables
-
*File C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py in create_table at
line 463* code arguments variables
-
*File C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py in
create_sequence_and_triggers at line 1307* code arguments variables
-
*File C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py in execute at line
1326* code arguments variables
-
*File C:\Program Files
(x86)\web2py\gluon\packages\dal\pydal\adapters\base.py in log_execute at
line 1320* code arguments variables
Function argument list
(self=<pydal.adapters.sqlite.SQLiteAdapter object>, *a=('CREATE TABLE
PostalCode(\n id INTEGER PRIMARY ...ER REFERENCES auth_user (id) ON DELETE
CASCADE\n);',), **b={})
Code listing
1315.
1316.
1317.
1318.
1319.
1320.
1321.
1322.
1323.
1324.
command = self.filter_sql_command(command)
if self.db._debug:
self.db.logger.debug('SQL: %s' % command)
self.db._lastsql = command
t0 = time.time()
ret = self.cursor.execute(command, *a[1:], **b)
self.db._timings.append((command,time.time()-t0))
del self.db._timings[:-TIMINGSSIZE]
return ret
Variables a ('CREATE TABLE PostalCode(\n id INTEGER PRIMARY ...ER
REFERENCES auth_user (id) ON DELETE CASCADE\n);',) b {} self
<pydal.adapters.sqlite.SQLiteAdapter
object> ret undefined self.cursor <sqlite3.Cursor object> command 'CREATE
TABLE PostalCode(\n id INTEGER PRIMARY ...ER REFERENCES auth_user (id) ON
DELETE CASCADE\n);' self.cursor.execute <built-in method execute of
sqlite3.Cursor object>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.