why is my database zero-length after commiting a record

28 views
Skip to first unread message

metaperl

unread,
Mar 18, 2011, 7:18:20 PM3/18/11
to web2py-users
web2py shell transcript of session resulting in no records in sqlite
storage.db file after doing an insert with no error:

[thequietcenter@ubuntu ~/prg/yinyogaworks] ../web2py/web2py.py --
shell=tmp
web2py Enterprise Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.94.4 (2011-03-18 02:53:34)
Database drivers available: SQLite3, pymysql, CouchDB
WARNING:web2py:import IPython error; use default python shell
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> db = DAL('sqlite://storage.db')
>>> db.define_table('asanas', Field('name'), Field('img_url'), Field('page_url'))
<Table {'ALL': <gluon.dal.SQLALL object at 0x897b6ac>,
'virtualfields': [], '_sequence_name': 'asanas_sequence', 'name':
<gluon.dal.Field object at 0x897b24c>, '_referenced_by': [], 'fields':
['id', 'name', 'img_url', 'page_url'], '_db': <DAL {'_lastsql': '',
'_db_codec': 'UTF-8', '_fake_migrate': False, '_dbname': 'sqlite',
'_adapter': <gluon.dal.SQLiteAdapter object at 0x897b2cc>,
'check_reserved': None, '_uri': 'sqlite://storage.db', 'tables':
['asanas'], 'asanas': <Table {...}>, '_migrate': True, '_pool_size': 0}
>, '_dbt': 'applications/tmp/databases/
fb87181b96a99be45f5a23f4277867ce_asanas.table', '_trigger_name':
'asanas_sequence', '_loggername': 'applications/tmp/databases/
sql.log', '_tablename': 'asanas', '_format': None, '_id':
<gluon.dal.Field object at 0x897b66c>, 'img_url': <gluon.dal.Field
object at 0x897b40c>, 'id': <gluon.dal.Field object at 0x897b66c>,
'page_url': <gluon.dal.Field object at 0x897b5ec>}>
>>> db.asanas.insert(name='placeholder', img_url='http://place', page_url='http://holder')
1
>>> db.commit()
>>>
[thequietcenter@ubuntu ~/prg/yinyogaworks] ls -l
total 12
drwxr-xr-x 2 thequietcenter thequietcenter 4096 2011-03-18 12:10 dojo
-rw-r--r-- 1 thequietcenter thequietcenter 1037 2011-03-18 19:07 grab-
asanas.py
-rw-r--r-- 1 thequietcenter thequietcenter 333 2011-03-18 08:40 grab-
asanas.py~
-rw-r--r-- 1 thequietcenter thequietcenter 0 2011-03-18 19:07
storage.db
[thequietcenter@ubuntu ~/prg/yinyogaworks]

Tom A

unread,
Mar 19, 2011, 9:01:39 AM3/19/11
to web...@googlegroups.com
Do you have another instance of web2py running in addition to the shell instance?

If you do, then the sqllite db will be locked and the inserts will fail.  Try stopping all other instances of web2py.

Nik Klever

unread,
Mar 19, 2011, 12:08:13 PM3/19/11
to web2py-users

your database is located in the folder ../web2py/applications/tmp/
databases/

Nik Klever

unread,
Mar 19, 2011, 12:18:17 PM3/19/11
to web2py-users

your database is located in the folder ../web2py/applications/tmp/
databases/


On 19 Mrz., 00:18, metaperl <scheme...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages