[PonyORM-list] Changing schema during development?

Tobiah toby at tobiah.org
Mon Oct 2 22:10:32 UTC 2017


So as of today, I'd have to lose my data to add/remove fields?

Is it not possible to let the database drive the structure and
dynamically create the entity classes somehow based on introspection
of the database?

Thanks,

Tobiah

On 10/02/2017 02:45 PM, Alexander Kozlovsky wrote:
> Hi Tobiah!
> 
> Soon we will release a migration tool which should help with updating 
> the database schema.
> 
> Until this, during the early stage of development you can drop all 
> tables and re-create them:
> 
>      # update_db.py
> 
>      from models import db
>      from settings import db_params
>      from initial_data import populate_database
> 
>      db.bind(**db_params)
>      db.generate_mapping(check_tables=False)
>      db.drop_all_tables(with_all_data=True)
>      db.create_tables()
>      populate_database()
> 
> 
> Best regards,
> Alexander Kozlovsky
> 
> 
> On Tue, Oct 3, 2017 at 12:05 AM, Tobiah <toby at tobiah.org
> <mailto:toby at tobiah.org>> wrote:
> 
>     I'm new to ORMs in general.  I used the online tool to
>     create a set of entities and used the resulting python
>     class set in a python program to automatically generate
>     a mysql database.
> 
>     Now I've decided that I want to change one of my 'int' types to
>     a 'str'.  I did this in the corresponding class and re-ran
>     the program, but my database field type was not updated.
>     How does one normally handle a changing schema during
>     development?  Do you have to puff the database and rebuild
>     every time there is a change?
> 
>     Also, does anyone ever somehow generate the Pony classes at
>     runtime based on introspection of the database?
> 
> 
>     Thanks,
> 
> 
>     Tobiah
>     _______________________________________________
>     ponyorm-list mailing list
>     ponyorm-list at ponyorm.com <mailto:ponyorm-list at ponyorm.com>
>     /ponyorm-list
>     </ponyorm-list>
> 
> 
> 
> 
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
> 


More information about the ponyorm-list mailing list