compare_model_to_db and update_db_from_model

47 views
Skip to first unread message

Paul Johnston

unread,
Nov 5, 2009, 4:12:30 AM11/5/09
to migrate-users
Hi,

I've just been using these two commands and they're exactly what I'm
after.

I did have a problem with update_db_from_model, getting an exception
in some circumstances
http://dpaste.com/116557/

Do they really need a repository to work? I'll have a look at making
them work without, as I don't use the repository for change scripts.

Also, the names are really long to type. How about we create some
shorter aliases: diff / sync.

Regards,

Paul

Christian Simms

unread,
Nov 5, 2009, 3:02:28 PM11/5/09
to migrat...@googlegroups.com
On Thu, Nov 5, 2009 at 4:12 AM, Paul Johnston <paul...@gmail.com> wrote:

Hi,

I've just been using these two commands and they're exactly what I'm
after.
 
I originally wrote that code a while ago, but have been busy.  Plus, it seems that I can never actually use sqlalchemy migrate on consulting projects because of project-specific requirements. How annoying!
 
I did have a problem with update_db_from_model, getting an exception
in some circumstances
http://dpaste.com/116557/
 
Perhaps your sqlalchemy model has a mismatch between foreign key definitions and corresponding primary keys.
 
Do they really need a repository to work? I'll have a look at making
them work without, as I don't use the repository for change scripts.
 
For the most part now.  But they use it to be consistent w/other commands.
 
Also, the names are really long to type. How about we create some
shorter aliases: diff / sync.

We made them long because with the short words it's ambiguous which direction you're going: does sync go from db to model or vice versa?  But I like short names as an alias.

 
Regards,

Paul

Cheers,
Christian
 



Domen Kožar

unread,
Nov 5, 2009, 4:14:13 PM11/5/09
to migrate-users
I have refactoring of schemadiff on my todo list, but currently I'm
too busy with exams. If anyone wants to drop-in, I can explain how I
imagined the hopefully-better-implementation.

All-in-all, if I manage to grab some extra++ time, I will do a rewrite
of migrate and fix design mistakes (and one of them that schemadiff
should really be external package, for wider useage)

On Nov 5, 9:02 pm, Christian Simms <christian.si...@gmail.com> wrote:

Paul Johnston

unread,
Nov 13, 2009, 4:56:41 AM11/13/09
to migrate-users
Hi,

> > Do they really need a repository to work? I'll have a look at making
> > them work without, as I don't use the repository for change scripts.

> For the most part now.  But they use it to be consistent w/other commands.

I've put a patch on ticket 70 that lets them function without a
repository. That's good for me, as I'd rather not have to create and
code control the repository.

> We made them long because with the short words it's ambiguous which
> direction you're going: does sync go from db to model or vice versa?  But I
> like short names as an alias.

With diff it doesn't matter, the output makes clear the direction.
Perhaps syncdb would be better than sync. I've supplied a patch for
this on ticket 71.

The exception that raised the other day hasn't happened again, I'll
keep my fingers crossed.

Regards,

Paul
Reply all
Reply to author
Forward
0 new messages