Migrating a hude database from Spring to web2py

44 views
Skip to first unread message

Tushar Tuteja

unread,
Jan 9, 2014, 5:53:10 AM1/9/14
to web...@googlegroups.com
I have a J2EE application and a database which has 200 tables in it.
I want to develop a new application using web2py, which would use only 5 tables.
I want to know how should I go about it. As I am not clear about how I would use database without mapping all the 200 tables which is a huge task.
and I don't want web2py to make any changes on the database tables and their schema.
only crud operations on the records of the 5 tables.
 
Thanks,
Regards,
Tushar Tuteja

Michele Comitini

unread,
Jan 9, 2014, 6:59:18 AM1/9/14
to web...@googlegroups.com
Instantiate the DAL with fake_migrate=True, migrate=False,migrate_enable=False
Define the tables with only the fields you are going to need in a model file.
This is going to create the metadata needed by web2py without touching your legacy database schema.




2014/1/9 Tushar Tuteja <ttu...@gmail.com>

--
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+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Paolo Valleri

unread,
Jan 9, 2014, 8:15:21 AM1/9/14
to web...@googlegroups.com
Mind that DAL should be instantiated with fake_migrate_all; 
run your app once, then you can set it to false. This operation will create several files (one for each defined table) in the app/databases/ directory

moreover, do you need to alter the 5 tables you mentioned?

Paolo

Tushar Tuteja

unread,
Jan 9, 2014, 8:18:50 AM1/9/14
to web...@googlegroups.com
No,
I don't want to alter the 5 tables schema.
But I want to perform CRUD operations.
And it would be great if somehow I can restrict web2py from altering table schemas all together as a J2EE application is running on the same the DB and DB is a remote DB.
thanks,
Tushar Tuteja


You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/BPabc0lulcw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.



--
Tushar Tuteja
Undergraduate Student(Fourth Year)
Civil Engineering
IIT Delhi
"The question isn't who is going to let me; its who is going to stop me!" - Howard Roark

paolo....@gmail.com

unread,
Jan 9, 2014, 8:35:48 AM1/9/14
to web...@googlegroups.com
Then set the three variables Michele mentioned to false directly, it is not necessary to create any metadata,
the following code snippet print the station name from a remote database (vpn address), the powerful thing is that the table station has several fields but I defined only once :)

        migrate=False,
        migrate_enabled=False,
        lazy_tables=True,
        pool_size=3
)

db.define_table('station',
        Field('name')
)

print db(db.station).select()


 Paolo


2014/1/9 Tushar Tuteja <ttu...@gmail.com>

Anthony

unread,
Jan 9, 2014, 8:48:20 AM1/9/14
to web...@googlegroups.com
Note, it is not necessary to bother with migrate=False if you are setting migrate_enabled=False -- the latter will prevent all migrations (the former is simply used to set the default value of the "migrate" argument for each .define_table in case it is not explicitly set, but that is ignored when migrate_enabled=False). There should be no need for fake_migrate if there are no plans to do any migrations at all.

Anthony

On Thursday, January 9, 2014 8:35:48 AM UTC-5, Paolo Valleri wrote:
Then set the three variables Michele mentioned to false directly, it is not necessary to create any metadata,
the following code snippet print the station name from a remote database (vpn address), the powerful thing is that the table station has several fields but I defined only once :)

Reply all
Reply to author
Forward
0 new messages