Unfortunately there is no py4web tag (that and one for modules should be added) so i put it under web2py as DAL is the same. If someone can create a tag (maybe talking to Massimo ..) its appreciated.
Its possible to access nearly whatever database with py4web/web2py. With autoimport its not necessary to define the fields again.
from pydal import DAL, Field
db = DAL('sqlite://legacydb.sqlite', folder='subdirectory/additionalsubdirectory', auto_import=True)
Now it should be possible to get all tables, columns etc. (In Oracle: select * from all_tables, select * from user_tab_columns etc are available for this)
db.tables
Its not working. (Its said its empty but there are two tables.
db.person.fields
Even knowing that a table person is there, the fields are not shown.
But its working when the database and the tables are created and I 'aks' immediately afterwards.
How can this be done?
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
notebook2
result for command
on notebook2 is same like notebook1
but when remove *.table on database folder and rerun notebook2 the result for
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