Solved - Python: automate input to MySQL query

D'Arcy J.M. Cain darcy at druid.net
Thu Sep 24 15:27:04 CEST 2009


On Thu, 24 Sep 2009 08:49:02 -0400
Joe Riopel <goon12 at gmail.com> wrote:
> On Wed, Sep 23, 2009 at 4:21 PM, D'Arcy J.M. Cain <darcy at druid.net> wrote:
> > In any case, I have a strong philosophical objection to using the same
> > name to refer to two different things regardless of any operational
> > issues.  The manager.firstname and employee.firstname are not the same
> > thing and should have different names to reflect that.
> 
> They are in separate tables, that should be enough to reflect the fact
> that they're not the same thing.

But manager_id (to join the employee to their manager) is in both tables
and it does refer to the same thing.

> > A similar issue comes up in the classic situation of the inventory table
> > price field and the sale item price field.  They sound like the same
> > thing but they are not.  One is the current price in the catalogue and
> > the other is the price it was sold for at a particular time.  They need
> > different names for that reason.
> 
> I am not sure if you're talking about two different tables (inventory
> and sale?). If you meant a single table; I would hope you don't have
> two columns, with the same name, in a single table. If you were
> talking about two different tables, see my above comment.

I'm talking about two different tables.  Consider an inventory table
that includes the current price of an item.  The invoice line item
table references the inventory table for details of the item.  A
classic mistake is to use the price from the inventory table to
determine the total price (item.quantity * invent.price).  The problem
is that the price may change tomorrow but the price it was sold for
yesterday does not.  Hence, invent.price and item.price are not the
same thing and I would name one of them differently.

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list