Skip to main content
Solved

Can I mark an ERD field as primary and foreign key during import?

  • November 6, 2025
  • 3 replies
  • 124 views

Forum|alt.badge.img+1

Hi,

I’ve generated a csv file that appears to be in the right format to import database data into a Lucidchart ERD.

The import works, and I can display my ERD chart, and see the foreign key joins, but for fields in tables that are both Primary Keys and Foreign Keys, and I populate the constraintType column of my import csv file with:

"PRIMARY KEY, FOREIGN KEY"

the ERD chart only ever seems to show ‘FK’ in the Key column, and not ‘PK / FK’. I’ve tried widening the Key column just to check that the text hasn’t been truncated, but the column only seems to be populated with either FK or PK, and not PK / FK where the import file defines it.

 

Any help or suggestions gratefully received.

 

Paul

Best answer by Zuzia S

Hi ​@Paul.Gr, thank you for your post and thank you ​@aparrish for chiming in!

Lucid does support marking a field as both a Primary Key and a Foreign Key during import, but it requires the constraintType value in the CSV to be formatted correctly. In some cases, you may need to make small manual adjustments to the import data to ensure the PK/FK state shows properly.

If you’re still seeing only PK or FK, feel free to share a snippet of your CSV (with any sensitive info removed), and we can help identify what might need adjusting.

We’re very interested in your feedback and committed to continually improving our products. Please first search the Product Feedback section of this community (with the filter Topic Type = Idea) to see if it’s already been submitted. If so, please add any additional details you’d like and upvote the request - this consolidation helps to refine feedback and properly capture the popularity of the request.

If no one has submitted this idea yet, please create one of your own and be sure to include details about your use case or what you’d like to see in this experience. This will also allow other users with similar requests to discover and upvote it, then add details of their own.

Finally, for more information on how Lucid manages feedback via this community, take a look at this post:

Cheers!

Comments

aparrish
Lucid Legend Level 7
Forum|alt.badge.img+15
  • Lucid Legend Level 7
  • November 8, 2025

@Paul.Gr I found a related help article that might be able to help you with this.

https://help.lucid.co/hc/en-us/articles/16471565238292-Create-an-Entity-Relationship-Diagram-in-Lucidchart. If it doesn’t help, I suggest submitting a ticket to our Product Support team.


Zuzia S
Forum|alt.badge.img+8
  • Lucid community team
  • Answer
  • November 19, 2025

Hi ​@Paul.Gr, thank you for your post and thank you ​@aparrish for chiming in!

Lucid does support marking a field as both a Primary Key and a Foreign Key during import, but it requires the constraintType value in the CSV to be formatted correctly. In some cases, you may need to make small manual adjustments to the import data to ensure the PK/FK state shows properly.

If you’re still seeing only PK or FK, feel free to share a snippet of your CSV (with any sensitive info removed), and we can help identify what might need adjusting.

We’re very interested in your feedback and committed to continually improving our products. Please first search the Product Feedback section of this community (with the filter Topic Type = Idea) to see if it’s already been submitted. If so, please add any additional details you’d like and upvote the request - this consolidation helps to refine feedback and properly capture the popularity of the request.

If no one has submitted this idea yet, please create one of your own and be sure to include details about your use case or what you’d like to see in this experience. This will also allow other users with similar requests to discover and upvote it, then add details of their own.

Finally, for more information on how Lucid manages feedback via this community, take a look at this post:

Cheers!


Forum|alt.badge.img+1
  • Author
  • May 12, 2026

Hi ​@Zuzia S

Sorry for the slow response, here is a snippit of my CSV that I import, it contains 2 tables that in them selves are not joined in any way, but both tables have a field that is both a Primary and Foreign Key.

When the table FieldGroupDataDictionary is drawn on the ERD, the field DataDictionaryObjectGuid is defined as both a Primary and Foreign Key field, but the ERD only describes the field as a Foreign Key.

When the table ForeignKey is drawn on the ERD, the field FieldGroupObjectGuid is also defined as a Primary and Foreign Key field, and in this instance, the field is correctly defined as both a Primary and Foreign Key. I included a screen shot of both tables in the ERD so you can see the output.

The CSV output is being programatically generated, and appears to be using the same format when defining the constraint_type.

Any advice you can offer greatfully received.

 

Thanks

Paul

 

dbms,table_catalog,table_schema,table_name,column_name,ordinal_position,data_type,character_maximum_length,constraint_type,reference_table_schema,reference_table_name,reference_column_name
azuresql,Classifications,Discovery,FieldGroupDataDictionary,_processing_action,1,string,,,,,
azuresql,Classifications,Discovery,FieldGroupDataDictionary,_processing_timestamp,2,timestamp,,,,,
azuresql,Classifications,Discovery,FieldGroupDataDictionary,DataDictionaryObjectGuid,3,string,,"PRIMARY KEY, FOREIGN KEY",Discovery,DataDictionary,ObjectGuid
azuresql,Classifications,Discovery,FieldGroupDataDictionary,EffectiveFromTimestamp,4,timestamp,,PRIMARY KEY,,,
azuresql,Classifications,Discovery,FieldGroupDataDictionary,FieldGroupObjectGuid,5,string,,"PRIMARY KEY, FOREIGN KEY",Discovery,FieldGroup,ObjectGuid
azuresql,Classifications,Discovery,FieldGroupDataDictionary,EffectiveToTimestamp,6,timestamp,,,,,
azuresql,Classifications,Discovery,ForeignKey,_processing_action,1,string,,,,,
azuresql,Classifications,Discovery,ForeignKey,_processing_timestamp,2,timestamp,,,,,
azuresql,Classifications,Discovery,ForeignKey,EffectiveFromTimestamp,3,timestamp,,PRIMARY KEY,,,
azuresql,Classifications,Discovery,ForeignKey,FieldGroupObjectGuid,4,string,,"PRIMARY KEY, FOREIGN KEY",Discovery,FieldGroup,ObjectGuid
azuresql,Classifications,Discovery,ForeignKey,Title,5,string,,PRIMARY KEY,,,
azuresql,Classifications,Discovery,ForeignKey,EffectiveToTimestamp,6,timestamp,,,,,