Join tables with foreign keys automatiically [Apr 23]

:raising_hand_man: BoMBx asked

Hi, I have a question. Does nocodb join tables which have foreign keys automatically ? If yes, can I set if don’t want it to join automatically?

:raising_hand_man: wkw replied

Yes and No. Columns with LinkToAnotherRecord type will be created.

:raising_hand_man: wkw replied

Discussed with user in DM. Here’s the summary.

Question 1: Want to query a table in REST API call but excluding some fields

Ans: Using fields to determine which fields to show.

Example:

/api/v1/db/data/{orgs}/{projectName}/{tableName}/views/{viewName}?fields= field_name,field_name2

Question 2: Query a table joining another table with some identical column names. Would it be any conflicts.

Answer:

In the returned json, the LinkToAnotherRecord data is presented in a nested way. For example, table A and table B both have a ManyToMany column.

In GUI, you will see TableBMMList in TableA and TableAMMList in Table B

if you call the api, you should see

{

field1: ‘xxx’,

field2: ‘xxx’,

TableAMMList: [{…}, {…}, {…}],

created_by: ‘xxx’

}

Similarly, for HasMany column, it will be TableARead

{

field1: ‘xxx’,

field2: ‘xxx’,

TableARead: {…},

created_by: ‘xxx’

}

so one can identify TableARead.field1 and field1

Autogenerated from discord


Join NocoDB’s community

DiscordTwitterRedditDocs