How to link foreign keys & primary keys using python?

sonal sonaldgr8 at gmail.com
Mon Jun 12 02:41:03 EDT 2006


Hi Mr. George,
Sorry for confusing u so much...
Let me try it again...

 I am not using any relational database to store the required tables
with primary keys & foreign keys....

When I say PRIMARY KEY =>
1. It means an index is created on the specified fields
    (Out of various fields given in the comma separated txt file)
FileFormat: CODE, FIRST_NAME, last_name, area_of_expertise, country
Eg:  A1,Harry,George, python, XYZCOUNTRY--------(1st record)

2. The index can be formed on a single field or on multiple fields
    Eg: a. 'CODE' (single field ) {pk_code}
          b. 'CODE' & 'NAME' (multiple fields ) {pk_code_fname}

Now when I say FOREIGN KEY =>
1. If the foreign Key is formed on the field 'CODE' in another text
file
 Format: subsriber_code,CODE,first_name, no_of_posts,active(Y/N)
 Eg:   SUB_001, A1, Harry, 50, Y

   This means the CODE (A1) given here is checked in the index formed
above
   with primary key: pk_code...

2. If the foreign Key is formed on the fields 'CODE' & 'FIRST_NAME'
    Format: subsriber_code,CODE,FIRST_NAME, no_of_posts,active(Y/N)
        Eg:   SUB_001, A1, Harry, 50, Y

   This means the CODE (A1) & FIRST_NAME (Harry) given here
   are checked in the index formed above with primary key:
pk_code_fname...

I am done till here.....

The problem starts if I have defined an index on multiple fields
(composite PK)
say: CODE & FIRST_NAME (pk_code_fname)
and if I need to define a FK on a single field out of these
say: CODE

I am unable to do that...
Mr. George, I thought i must explain the code i am dealin with,
for better understanding.., but i am sorry i confused you all the more
(incase, u want to view the code please refer to the code snippets in
my first query posted) 

Thanks & regards,
sonal




More information about the Python-list mailing list