foreign key tab missing foreign key
Hi,
Although below is in my DDL tab, but in the foreign key tab, there was nothing inside, any advice?
CONSTRAINT `Contraint_1` FOREIGN KEY (`customer_id`) REFERENCES `customers` (`customer_id`) ON DELETE CASCADE
Thank you
Hi Jaycus!
Thanks for reaching out.
Did you refresh the Schemas section (in the bottom-left corner of the screen) prior to opening the "Foreign keys" tab? Please retry after refreshing the section. Thank you.
Hope this helps.
Best,
Martin
Hi Martin,
Yes, i have checked other tables as well that already had foreign keys, they were empty too, not sure why is the case.
E.g. the below table dept_emp table that already had foreign keys, it was empty as well.
Hi Jaycus!
Thanks for your reply.
Regardless of the number of tables and foreign keys you create throughout a MySQL session, please make sure you refresh the Schemas section prior to examining these tabs. To do that, you need to press this tiny icon.
Hope this helps but please feel free to get back to us should you need further assistance. Thank you.
Kind regards,
Martin
Hi Martin,
Yes i have refreshed many times while following through the lectures, but it still did not appear in the tab.
Hi Jaycus!
Thanks for your reply.
It seems it is all a matter of connection/settings. Otherwise the code and the way in which you check the foreign constrain is absolutely correct. So, I am trying to think of what prevents you from seeing the foreign keys themselves.
First, have you set 'sales' to be your default database? I.e. have you executed
USE sales;
prior to refreshing the Schemas section etc.?
Also, can you make sure you are using a single connection while currently working on Workbench (i.e. have you started several connections as opposed to a single one)?
Hope this helps but please feel free to get back to us should you need further assistance. Thank you.
Best,
Martin
Hi Martin,
Can i confirm that you meant the employees database? Don't recall that we have a sales database.
i have only created and connects to 1 connection so far in this course, can't seems to figure out what's the issue for the missing foreign keys in the foreign key tab ):
Also, i realized that if i tried to refresh inside the foreign key tab, my whole MySQL workbench get shut down, it's weird because it doesn't happen when i refreshed other tabs or refreshed the schemas section,
Not sure if there's something wrong with my MySQL workbench. :\
Hi Jaycus!
I am sorry this issue lasts for a little longer on your end but please bear with us - this is indeed a bit more of a software (i.e. Workbench) issue rather than a MySQL issue, so it might take a few steps before we manage to solve the problem. I hope it won't be necessary to refer to the creators of Workbench for that.
Indeed, you opened up the thread by referring to the "customers" table, so I thought you might be working with the "sales" database (which is what we do in Section 5 of the course). The employees database is not used earlier than Section 8 of the course.
Hope this helps but please feel free to get back to us should you need further assistance. Thank you.
Best,
Martin
Hi Martin,
No problem! will this missing tab cause any big issues? else, i can live with it since i could still find the foreign keys from the DDL tab.
Thank you
Hi Jaycus!
Thank you very much for the understanding.
No, this missing tab will cause absolutely no issues in terms of proceeding with and completing the course. We have talked about it since we wanted to share with our students all advantages Workbench can offer to their users.
Sometimes, such discrepancies appear - either due to the difference of the versions a student is using (with respect to the one that we have installed on our end) or because of the order in which you have executed various operations throughout a session on your end.
I'd suggest - complete the course and all attached exercises first, and then feel free reconnect to the database, drop and recreate all databases, get to the point of creating the same foreign key, and then check the DDL tab. If the issue persists, than it may be that your version does not support it (although that is less likely, but according to our observations, sometimes this is the case).
Hope this helps.
Regards,
Martin
The issue commented above happened to me too
Hi Days!
Thanks for reaching out.
Hope you've managed to resolve it but please let us know if you need any assistance to proceed with the course smoothly.
Kind regards,
Martin
I have the same issue. I did everything you mentioned above, but I still have nothing in my Foreign Keys tab when my DDL clearly shows that I do. Why is this?
Hi Marcus!
Thanks for reaching out.
Sorry to hear the suggestioned mentioned above did not help.
Can you please confirm you've managed to reconnect to the database by pressing the following button
and then managed to create the table and all its constraints? If yes, do you refresh the schema by pressing the following button
and then check the DDL again?
Looking forward to your answer.
Kind regards,
Martin
Hi Martin,
The same issue here, it also showing an error message when I click on refresh as below:
I've applied all the mentioned steps above, but it didn't work with me.
To make my reply helpful, I will share the last lines of my log file:
19:32:43 [INF][ TableEditorBE]: Creating stub schema and table sales.customers for foreign key
19:33:48 [WRN][ mforms]: Resource file not found: db.Constraints.16x16.png
19:33:48 [WRN][ mforms]: Resource file not found: db.Partitions.16x16.png
19:33:48 [WRN][ mforms]: Resource file not found: db.Grants.16x16.png
19:33:48 [WRN][ mforms]: Resource file not found: db.Grants.16x16.png
19:33:48 [ERR][sqlide_tableman_ext.py:show_table:1186]: Error initializing tab constraints: Traceback (most recent call last):
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_tableman_ext.py", line 1183, in show_table
tab.show_table(schema, table)
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_tableman_ext.py", line 854, in show_table
self.refresh()
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_catalogman_ext.py", line 373, in refresh
self.preload_data(self.get_query())
File "C:\Program Files\MySQL\MySQL Workbench 8.0\modules\sqlide_catalogman_ext.py", line 367, in preload_data
node.set_string(i, rset.stringFieldValueByName(field) or "" if format_func is None else format_func(rset.stringFieldValueByName(field)))
SystemError: invalid column constraint_name for resultset
19:33:51 [ERR][ pymforms]: Unhandled exception in Python code:
19:33:59 [ERR][ pymforms]: Unhandled exception in Python code:
I hope this helps.
I'm having the same problem. After following the steps in the video to set the foreign key via the GUI, the constraint is created in the DDL, but the Foreign Keys tab does not show the relationship.
Even when I recreate the table with code the foreign keys tab is empty
Hi ,
I'm having the same problem with foriegn keys , anyone succeeded in solving the problem !!?
Same problem here!
Hi Nour and Felipe!
Thanks for reaching out!
It seems this is a problem with the Workbench. If you install another version it should
be resolved. Nevertheless, the foreign key should be correctly created as of now so you needn't
worry about this exception.
Hope this helps.
Best,
Martin
Hi Megdad, Adam, Nour and Felipe!
Thanks for reaching out.
It seems this is a problem with the Workbench. If you install another version it might go away. Anyways, the foreign key should be correctly created, so no need to worry about this exception.
Hope this helps.
Best,
Tsvetelin