Re: PK and FK questions

2010-04-07 Thread Peter Herndon

On Apr 7, 2010, at 11:45 AM, ojayred wrote:

> Hello All,
> 
> I am new to Django and thinking about migrating to Django from our
> existing web environment. I had a couple of questions that I would
> like help in answering them.  Your insight is greatly appreciated.
> Thank you.
> 
> 1) Considering, there is no support for Multiple Primary keys, how
> would Django react if my tables have multiple primary keys and I tried
> to update or delete a record? I am just curious.

I don't know the answer, but assuming you already have tables built in your 
database, you can run "manage.py inspectdb" to see what ORM code Django would 
generate from such a table.  If it generates something useful, then you are in 
business.  In short, test.  It shouldn't pose too much of a problem in a 
development environment.

> 
> 2) I read somewhere that each table must have one primary key? Some of
> our tables have no primary keys.

Then you are doing it wrong in your database.  Every table should have a 
primary key, regardless of how few rows it may have.  Otherwise, your database 
has (theoretically, not usually true in practice) no means of determining one 
row from another.  

As others have mentioned, a Django model by default uses an autoincremented 
integer field as an artificial primary key, if you don't otherwise specify a PK 
in the model definition.

> 
> 3) Is there a limit on the number of Foreign Keys in a table?

I don't believe Django imposes such a limit.  More likely, such a limit would 
be imposed by your database.

> 
> 4) How often would I need to patch and/or upgrade Django? And is this
> a difficult procedure?

It depends.  If your web application faces the public Internet, you will want 
to start with a current release of Django, and stay up to date with security 
and bugfix releases.  If your web app is internal-only, I would still argue you 
should update for bugfixes and security releases, but you could likely get away 
with not updating, depending on the security policies of your company.

You mention your test environment is OpenVMS.  I don't know much about OpenVMS, 
except to say that when I used VAX/VMS in college many years ago, it was not 
Unix.  As such, I don't know whether Python will work on your system.  Assuming 
it does, then Django itself should run well enough.  That also means that 
standard Python facilities for managing module installations should also work.  
You can thus use Distribute and Pip to keep your Django install up to date 
fairly easily.

The harder question is whether you will need to modify your application to run 
with the updated version of Django.  The Django core developers make a very 
strong effort to maintain backwards compatibility, and you can thus assume that 
updating from e.g. version 1.1.0 to 1.1.1 will be painless.  But migrating from 
1.1.x to 1.2 will only be *mostly* painless.  Again, you can assume that 
everything will be backwards-compatible, but there may be the odd exception in 
the case of a bugfix.  Much more likely, there will be new and improved 
functionality introduced that you will want to use, that will necessitate 
changes in your code.  For instance, 1.2 will introduce the ability to connect 
to multiple databases.  The means of specifying multiple db connections in the 
settings file has of course changed to accommodate the new features, though the 
old settings structure will continue to work as-is.

Finally, as you work on your application, you may find yourself needing to 
modify the database table structures -- assuming you allow Django's ORM to 
manage your tables, which is a common case.  In that situation, the changes to 
the underlying DDL can be automated using a Django-aware schema migration tool. 
 South (http://south.aeracode.org/) is one such tool.

---Peter Herndon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: PK and FK questions

2010-04-07 Thread ojayred
For responses to 1 and 3.
Is there somewhere I can look?  I guess I will have to test these
capabilities along with unique_together to resolve the Multiple PK
issue.

For 2, I will have to add them as suggested.

For 4.
Sorry, I couldn't understand. Can you explain it again. :)
I have a test environment on an OpenVMS 8.3.  What is south?

Thanks Marcos & Hinnack

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



RE: Re: PK and FK questions

2010-04-07 Thread Henrik Genssen
Hi,

>> 1) Considering, there is no support for Multiple Primary keys, how
>> would Django react if my tables have multiple primary keys and I tried
>> to update or delete a record? I am just curious.
sorry, I do not know...

>> 2) I read somewhere that each table must have one primary key? Some of
>> our tables have no primary keys.
django adds one to each model, if you do not do it called "id"

>> 3) Is there a limit on the number of Foreign Keys in a table?
I do not think there is a limit, but do not know

>> 4) How often would I need to patch and/or upgrade Django? And is this
>> a difficult procedure?
depends on your OS - if you are on debian: apt-get update / upgrade if it is a 
minor update  - they
cept a lot of focus on backward capabilities
you may consider using south, if you have a lot of db changes yourself for 
migrating the db and the data

regards

Hinnack

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



Re: PK and FK questions

2010-04-07 Thread Marcos MarĂ­n
Hi, I'm not too experienced with django myself so I will let someone else
answer the rest of your questions. But for 2, wouldn't it be fairly simple
to create primary keys for these tables? worst case scenario you just add a
column that is a auto_incremented int and run a script to set it for
existing rows.

On Wed, Apr 7, 2010 at 10:45, ojayred  wrote:

> Hello All,
>
> I am new to Django and thinking about migrating to Django from our
> existing web environment. I had a couple of questions that I would
> like help in answering them.  Your insight is greatly appreciated.
> Thank you.
>
> 1) Considering, there is no support for Multiple Primary keys, how
> would Django react if my tables have multiple primary keys and I tried
> to update or delete a record? I am just curious.
>
> 2) I read somewhere that each table must have one primary key? Some of
> our tables have no primary keys.
>
> 3) Is there a limit on the number of Foreign Keys in a table?
>
> 4) How often would I need to patch and/or upgrade Django? And is this
> a difficult procedure?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.



PK and FK questions

2010-04-07 Thread ojayred
Hello All,

I am new to Django and thinking about migrating to Django from our
existing web environment. I had a couple of questions that I would
like help in answering them.  Your insight is greatly appreciated.
Thank you.

1) Considering, there is no support for Multiple Primary keys, how
would Django react if my tables have multiple primary keys and I tried
to update or delete a record? I am just curious.

2) I read somewhere that each table must have one primary key? Some of
our tables have no primary keys.

3) Is there a limit on the number of Foreign Keys in a table?

4) How often would I need to patch and/or upgrade Django? And is this
a difficult procedure?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.