please ensure that it refer to the same database folder, with *.table available there, if run pydal on py4web or terminal ensure that you execute db.commit() if not, it just store in memory not writen on database
e.g.
in jupyter notebook (created two notebook, 1 for define_table with auto_import=False and the other without define_table with auto_import=True)
notebook1
from pydal import DAL, Field
from datetime import datetime
now = datetime.now()
db = DAL('sqlite://jupyter_pydal.sqlite', folder = 'databases', auto_import = False)
db.define_table('test',
Field('string_0'),
Field('text_0', 'text'),
Field('integer_0', 'integer'),
Field('double_0', 'double'),
Field('date_0', 'date'),
Field('datetime_0', 'datetime'),
#format = lambda r: f'{r.name}' )
format = lambda r: '%s' % (r.name) )
if db(db.test).isempty():
p0 = db.test.insert(string_0 = 'string_0', text_0 = 'text_0', integer_0 = 0, double_0 = 0, date_0 = now, datetime_0 = now)
p1 = db.test.insert(string_0 = 'string_1', text_0 = 'text_1', integer_0 = 1, double_0 = 1, date_0 = now, datetime_0 = now)
db.commit()
db._uri
db._dbname
db.tables
db.test.fields
db.test.string_0.type
rows = db(db.test).select()
print(rows)
notebook2
from pydal import DAL, Field
db = DAL('sqlite://jupyter_pydal.sqlite', folder = 'databases', auto_import = True)
db._uri
db._dbname
db.tables
db.test.fields
db.test.string_0.type
rows = db(db.test).select()
print(rows)
result for command
db._uri
db._dbname
db.tables
db.test.fields
db.test.string_0.type
rows = db(db.test).select()
print(rows)
on notebook2 is same like notebook1
but when remove *.table on database folder and rerun notebook2 the result for
db.tables
db.test.fields
db.test.string_0.type
rows = db(db.test).select()
print(rows)
is not found on notebook2
ref for pydal on web2py site
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables