You don't mention...
- Which DB adapter you are using
- Why just one of your tables is expected to be an in-memory table and
the others not
- Why you don't simply maintain the list of tables in a list(), or
dict() or some other in-memory structure
In any case, maybe this idea might help...
db = DAL("sqlite://storage.sqlite") # or whichever DB you are using
dbmemo = DAL("sqlite:memory")
dbmemo.define_table('DatabaseModel', Field('TableName'))
for t in db.tables:
dbmemo.DatabaseModel.update_or_insert(TableName=t)
On Wednesday, 15 July 2020 07:45:36 UTC+1, Andrew Rogers wrote:
>
> This code working fine but now it fails because the db.define_table()
> returns None.
>
> table = db.define_table('DatabaseModel', Field('TableName')) # This is
> not working now
> for t in db.tables:
> table.update_or_insert(TableName=t)
>
> The only thing that I think I have changed that might have affected it was
> setting migrate = false in appconfig.ini. I have changed it back but to
> no avail.
>
> What could stop db.define_table from returning a table?
>
> (I am using this to create an in-memory table which I populate with a list
> of actual tables.)
>
> Thanks.
>
> PS:
> https://stackoverflow.com/questions/62908908/under-what-circumstances-would-db-define-table-return-none
>
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/27f8c1ed-26bb-46e1-8888-458bb280e780o%40googlegroups.com.