Re: big legacy database with complex many to many relationships

2014-02-24 Thread Tom Evans
On Mon, Feb 24, 2014 at 7:54 PM, Sells, Fred
 wrote:
> I have to integrate to a large read only legacy mssql database .
>
>
>
> The many-to-many tables have a lot of additional fields like start/end dates
> of the relationship and their own naming conventions
>
>
>
> Can anyone point me to some links that treat this topic in depth.  I’ve
> looked at the django book and that’s a starting point,
>
>
>
> Can anyone point me to some good “how to” links on this that provide some
> details and some pitfalls to watch for.
>

At $JOB we have very successfully integrated django into our existing
(homebrew) C++ ORM and web framework - we do new development in
django, and gradually the C++ code diminishes (only 390k LOC to go!).
Our objects are beyond complex, a typical item has some 100+ M2M
relationships, often with extra data in the join table. Django can
handle this mostly fine, I suppose the one caveat is that our
pre-existing system modelled very closely the database structure that
django would have used.

So if your data is nicely BCNF already, you shouldn't have many
problems. The Django docs has a section on integrating with legacy
databases, don't bother looking at it, it suggests to use inspectdb..

Instead, model your objects and then write django model classes for
them, one by one, setting the appropriate field and meta options so
that it finds the right tables and columns for that model. Lather,
rinse, repeat until all your models are done.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFHbX1LUjCXphTOXs7MGbKZw%2BxDAi0aT-vpOgBaJsj11-RtXtA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


RE: big legacy database with complex many to many relationships

2014-02-24 Thread Sells, Fred
Thanks,  I think you set me on the right track.

Fred.

-Original Message-
From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Javier Guerra Giraldez
Sent: Monday, February 24, 2014 3:12 PM
To: django-users@googlegroups.com
Subject: Re: big legacy database with complex many to many relationships

On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred <fred.se...@adventistcare.org> 
wrote:
> I have to integrate to a large read only legacy mssql database .


while certainly it's possible to configure this as a second database and use 
the ORM, I've found that it's more work than usually needed.
especially if you already have defined SQL patterns, or worse, stored 
procedures.  porting those to ORM means debugging them again...

but there's nothing preventing you from using any Python way to access that 
data.  particularly if you're going to treat it as read-only.
just write some utility functions that use ODBC or any other interface to pull 
your data and use that in your Django views, or even in your models.

--
Javier

--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoS1WBGDN80v5J%2BCh%2BXCx_g1SD2obvjG51AqO_YJA0mM7w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DCD75728F460F14586086EA606E8308201192B64A2%40ACEVXCHMBX1001.ADVENTISTCORP.NET.
For more options, visit https://groups.google.com/groups/opt_out.


Re: big legacy database with complex many to many relationships

2014-02-24 Thread Javier Guerra Giraldez
On Mon, Feb 24, 2014 at 2:54 PM, Sells, Fred
 wrote:
> I have to integrate to a large read only legacy mssql database .


while certainly it's possible to configure this as a second database
and use the ORM, I've found that it's more work than usually needed.
especially if you already have defined SQL patterns, or worse, stored
procedures.  porting those to ORM means debugging them again...

but there's nothing preventing you from using any Python way to access
that data.  particularly if you're going to treat it as read-only.
just write some utility functions that use ODBC or any other interface
to pull your data and use that in your Django views, or even in your
models.

-- 
Javier

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFkDaoS1WBGDN80v5J%2BCh%2BXCx_g1SD2obvjG51AqO_YJA0mM7w%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.