New to Web2Py: Large Model

53 views
Skip to first unread message

Juslin Guo

unread,
Feb 12, 2014, 10:58:29 AM2/12/14
to web...@googlegroups.com
Hi,

I have an application in PHP with 500 over tables, what's the best way to managed them in Web2Py, without repeating model definitions nor loading them all.

Rene Dohmen

unread,
Feb 14, 2014, 7:43:38 PM2/14/14
to web...@googlegroups.com
You could use 

extract_mysql_models.py

(in the web2py/scripts folder)

Carlos Correia

unread,
Feb 14, 2014, 9:21:07 PM2/14/14
to web...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,

You can follow this approach:
http://www.web2pyslices.com/slice/show/1479/model-less-apps-using-data-models-and-modules-in-web2py

Basicly, you move table defenitions from models to modules, only defining tables
as needed.

- --
Com os melhores cumprimentos,

Carlos Correia
=========================
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM: 917 157 146 / 967 511 762
e-mail: ge...@memoriapersistente.pt - URL: http://www.memoriapersistente.pt
Jabber: m1...@jabber.org
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlL+zxMACgkQ90uzwjA1SJUPhQCdHJpv8zAT9Op4DPj2uoREswi4
WdAAnivDivp9nuiBhO5Ve5rbp+Rd9Dlr
=aYSC
-----END PGP SIGNATURE-----

黄祥

unread,
Feb 14, 2014, 10:54:19 PM2/14/14
to web...@googlegroups.com
I have an application in PHP with 500 over tables

did you already create the web2py models for your current database? i mean using the extract script.
e.g.
web2py\scripts\extract_mysql_models.py

without repeating model definitions

pardon me, don't know what do you mean about this, if you mean the repeating model definitions is migrate, i think you can achieve it after you extract the database into models (above steps is done) and set in the dal :
migrate = False, fake_migrate_all = False
 
nor loading them all.

for this, i think the answer is same like the others suggestion, is to use the modelless (modules) or response.models_to_run(), your choice. 
if you follow the above steps (extract, and set the migrate value), i think you only can use response.models_to_run(), because in modelless (modules) you must redefine the tables again in modules.

best regards,
stifan
Reply all
Reply to author
Forward
0 new messages