PS: I want to use DAL for work with many tables and 2 databases at least , which are created by another noWeb2Py application.
вторник, 24 декабря 2013 г., 1:32:18 UTC+4 пользователь Kirill Surnov написал: > > Just tried it with postgresql: > there are some tables without web2py definition, and I dont see it! > other tables created on web2py I see. > trying in python shell from 2.7.4 + timestamp.2013.10.14.15.16.29 > db= DAL('postgresql://postgres:*******@localhost/test',auto_import = True) > > > > вторник, 7 февраля 2012 г., 21:26:05 UTC+4 пользователь Anthony написал: >> >> Just tried it -> same results. >>> FYI, I'm only using the interactive python shell to illustrate the >>> problem I face I my app... >>> >> >> When you use the -M option to load your models, are you then still doing >> this in your shell session: >> >> >>> db = DAL('postgres://postgres:********@localhost/courier') >> >> If so, don't -- the db object will already be defined when your db.py >> file is executed, and the above will end up overwriting it (and therefore >> losing all of its table definitions from db.py). Just do: >> >> python web2py.py -S courier -M -N >> >>> db.tables >> >> (Note the -N option -- that prevents cron from starting.) >> >> If you're using the DAL outside of a web2py app, then you'll still need >> to create model definitions (i.e., with db.define_table) in your code -- >> the DAL doesn't know what tables and fields are in your db unless you tell >> it by defining the models. However, if you have already defined the models >> in an app somewhere, you might be able to make use of auto_import: >> http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables >> . >> >> Anthony >> >> -- 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.