> > It sounds like instead, you would prefer for the module to create a table >> object so the table object can be imported directly (and then added to the >> DAL connection object of the current request) -- that way, the table object >> would be created only once, the first time it is imported. >> > > That's exactly what I meant. It would then refresh itself only when you make a change to the schema, as the module would have to be re-compiled on import-time on the next request.
In most ORMs/DALs there is a clear separation between the connection-object and the schema-object(s), and for good reason : schema-changes are few and far between - requests/connections are numerous and rapid - it makes no sense tying them together like that... It's a poor design-choice, IMHO. Of course, the problem with this approach is that you couldn't dynamically > change any attributes of the table or its fields (e.g., .readable and > .writable) at request time, because that would effect other requests as > well. > > I don't know that needing to define a per-request readable/writable is such a common use-case - or else I don't fully understand what you are alluding to... Are these definitions for security that are modified based on auth-definitions, after being cross-referenced with the request/session-user? If so, I guess they would have to be re-set automatically by the DAL object on each request, but that doesn't mean the entire-schema needs to be re-generated - the auth-definitions are already in the database anyways, and this means it's not a schema-related issue - it's just data that got bolted-onto the schema-objects for convenience... If it is taken from the database anyways (or even if it's caches), the bolted-on variables can be reset on each request in a thread-safe kind of way - though that may require further thinking... -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.