Toad World® Forums

problem building relationship


#1

new to Toad data modeller just purchased v2 and just trying the v3 beta.

i’ve reverse engineered several tables and want to add some relationships to them (in the data model using TDM). however, the primary key column and the foreign key columns (which already exist) are not of the same name.

when i try to build the relationship, it won’t seem to let me pick what col to use as FK on my own.

any ideas?

thanks, David S. - Tampa, Fl.


#2

Hello,

Concerning building relationships in TDM 3, it is the same as in version 2.

Some information that you can find helpful:

  • During RE, only relationships that physically exist in the database are loaded to TDM.
  • If you create a relationship in TDM, a new FK is created automatically in child entity.
  • Foreign keys mapping feature is available in TDM3 (and version 2 as well).

I recommend you to have a look at TDM3 Manual | Physical Data Model | Creating ER diagram | topic Understanding of Foreign Keys.

Well, I hope this information will help you a little.
Anyway, if you have any questions or if you think I’ve misunderstood your problem, please write me back. Thanks.

Have a nice day.

Vladka


#3

I’ve seen this behavious in other program (Visual Studio) where there was possible to interconnect two existing fields with relationship.

It could be a new feature in TDM3.

Accessible via, for example, shift/ctrl key while dragging relationship end to destination table. While dragging with the key, cursor would change and you would have to pick an existing compatible column instead of adding a new one.

This task is common when reverse engineering old MySQL tables (MyISAM, ISAM, …) that do not have relationships NOR transactions.


#4

Hi,

Just a remark on this:
Relationship refers to key, not to attribute. A key can have more attributes.

  • Therefore it works as it works in TDM.

I hope this info helps.

Regards,

Vladka


#5

Hey folks. thanks, a lot of that helped. i further have realized that the behavior is NOT the same between v2 and v3 (yea!)

it actually works fine in v3, it just didn’t appear to at first (because i didn’t read fully).

again, the situation is something like this:

tableA, colA1 -pk, colA2 (unique NN)

tableB, colB1 - pk, colB2 (want this to be a FK to colA2 in tableA)

what we need to do is something like:
Alter table “tableB” add foreign key (“colB2”) references “tableA” (“colA2”)

in V3, when i create the relationship, it first assumes i’m going to have a foreign key in tableB using a column named colA2. however, if i go to the Foreign Keys tab, although this looks the same as v2, it has an (apparently) new feature. it says to press f2 to change the selected child attribute. pressing that gives me a drop down list to select. i can’t find a way to do that in v2.

Thanks much. this is a great product, David Soniat


#6

Hello,

FK mapping in TDM3 versus in TDM2.

TDM2:
right-click the relationship | select Foreign Keys | ‘New FK’ drop-down list.

TDM3:
edit the relationship | Foreign Keys tab | ‘Child’ drop-down list.

I hope this helps.

Regards,

Vladka