dbf files and indexes

Ethan Furman ethan at stoneleaf.us
Thu May 27 16:33:59 EDT 2010


D'Arcy J.M. Cain wrote:
> On Thu, 27 May 2010 12:45:58 -0700
> Ethan Furman <ethan at stoneleaf.us> wrote:
>> Let's say I have two tables:
>>
>> CatLovers                DogLovers
>> -------------------      -------------------
>> | name      | age |      | name      | age |
>> |-----------------|      |-----------------|
> [...]
>> NumberOfPets
>> ---------------------------
>> | name      | cats | dogs |
>> ---------------------------
> [...]
> 
> First problem is learning to count.  :-)

Heh -- like I said, I'm terrible at making examples.  Originally it was 
two tables, then I threw in a third so I could show using an index as a 
dictionary.

 > Second (first real) problem is that you database is not normalized.
 > If all of the cat lovers and dog lovers are in NumberOfPets then move
 > the age into that.  Probably should rename it as well.

The actual tables that I would be using are different versions of 
mailing tables, with one table not having as many records as the other, 
and wanting to do something with the records that are in common between 
the two.

 > Finally, are these SQL databases?  The best way of getting information
 > is with SQL.

The format of these tables is either dBase III or Visual FoxPro 6, and 
dbf is a module I have coded (still working on SQL support for it... 
getting closer!).  A slightly out-of-date version of it is available on 
PyPI.

My question centers around the __contains__ method of the Index object 
that I am writing, and whether it should call the key function of the 
index when passed a record, or if I should make the calling code do that.

Hope this helps.

~Ethan~



More information about the Python-list mailing list