[Tutor] Return key from value

firephreek firephreek at earthlink.net
Fri May 14 14:47:34 EDT 2004

Crazy stupid-implementation, or crazy employer asking for a lot all at
once?  For the stupid proof, I thought that I might set up combo boxes
with wxPython, using the k/v to match, but I'm gonna re-work that I
think and use sql, maybe a combination, haven't set it in stone.  Danny
Yoo mentioned SQLite, and after looking into that a little, I think it
might be just what I'm looking for.  We'll see.  Being new and self
taught, I'm not always sure about which is the best way of doing things.
I have that tendency to overanlyze myself to a standstill, and that
doesn't help.

Biggest differences between mySQL and PostgreSQL?  I've heard of the
second, I use the first currently for some minor tracking and for
temperature recording.  It was the first thing I heard of that
interfaces with php and so I picked it up.  I'm happy with it, but if
there's that big a difference, I'll happily consider moving. 


-----Original Message-----
From: orbitz at ezabel.com [mailto:orbitz at ezabel.com] 
Sent: Friday, May 14, 2004 11:15 AM
To: firephreek
Subject: Re: [Tutor] Return key from value

Hrm, what yo uare doing sounds pretty crazy.  IMO, let SQL handle the
referencing and have your python rely on that.  Let's face it, Python IS
The interpreter is slow at doing things.  And unless I read you wrong,
you want speed.  SQL engines were made for this sorting through things
quickly, and your SQL engine is most likely way smarter than your OS at
keeping information paged in/out that is goign to be accessed often so
it can make things fast.  On another note, dump MySQL for PostgreSQL,
MySQL is junk:), but I doubt you can since it's your employerr and it
sounds like most of what you have is already written for mysql.  Anyways
good luck.

On Fri, 14 May 2004 08:56:27 -0700
"firephreek" <firephreek at earthlink.net> wrote:

> I'm writing a program to help with some database migration issues.  We

> have an system running an inventory/sales/invoicing program.  We're 
> going to open up another part of the program to help automate some of 
> our cost control/inventory tracking.  Unfortunatly this means 
> inputting a vendor name/info along with all products that we purchase 
> from said vendor.  This is on order of several thousand items.  More 
> even...So we're looking at several months worth of data entry.  I type

> decently fast, but not that fast.  But the way the system is, we can't

> put in the data, without actually using that portion of the program, 
> which will conflict with the way we currently use the program.  I (re:

> my employer) isn't willing to do that.  So, the idea behind this 
> program is that it'll read data from my Main System, and allow me to 
> match data from my incoming products/vendors to what exists in my 
> system, after several months of this when we've gotten everything 
> together, we can run a complete list of everything on my external db, 
> and then have 3-4 people do all the entry in a week.  System goes on 
> with minimal downtime, and we're only missing maybe 2% of total 
> possible inventory, which is an acceptable amount that we can make up
for as time goes on.
> Bah.  So, I need to build something stupid proof for my fellow 
> employees.  I'm the only one here who knows his elbow from a cat5 
> cable so to speak.
> I thought about duplicating my dictionary set (which will hold k/v to 
> match vend/# to vend/name so I can search against both.  But because 
> the set is going to be pretty big (I'll need to cross match item# vs.
> item/name) I was looking for the most efficient route, the other 
> option that occurred is to do a sql query against whatever attribute 
> is entered, and that may be the route I go with.  We have our own 
> MySQL server (love! Like python!), is it very different from sqlite?  
> Both key and value on all sets will be unique, so I'm not worried 
> about that. When is 'big' too big?  How far can I push before I see a 
> performance hit?  I think I'm just going to stop caring about 
> performance and let them suck it up. Though it hurts to think 
> that...ugh.
> That's the long and short of it.  I make no qualms about the fact that

> I'm new to some of this, but I'm also not a complete idiot.  I can use

> a hammer, I'll make this work one way or another. *grin*
> Stryder
> PS: gui is gonna be wxPython, and that's a whole 'nother bag of fish.
> -----Original Message-----
> From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On 
> Behalf Of orbitz at ezabel.com
> Sent: Thursday, May 13, 2004 12:38 PM
> To: tutor at python.org
> Subject: Re: [Tutor] Return key from value
> key -> value have a one to one relationship.
> value -> key have a 1 to many relatinoship.
> You will most likley need to iterate over your dictionary and check if

> the value matches, and construct a list of keys.
> If you have such a large datastructure, I wonder why you are doing 
> this in the first place?
> On Thu, 13 May 2004 12:13:59 -0700
> "firephreek" <firephreek at earthlink.net> wrote:
> > I thought there was a method for it, but I can't seem to find it.
> > 
> > Does anyone know how I can return the matching key from a dictionary
> > if I know the value?  I'm working with some very large data 
> > structures, and I don't want to have to duplicate them.
> > 
> > Stryder
> > 
> > 
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> _______________________________________________
> Tutor maillist  -  Tutor at python.org 
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list