Show referring tables and rows when the referring foreign key is compound
sqlite foreign keys can be compound, but that is not as well supported by datasette as single column foreign keys.
in particular,
- in a table view, there is not a link from the row to the referenced row if the foreign key is compound
- in a row view, there is no listing of tables and rows that refer to the focal row if those referencing foreign keys are compound.
Both of these issues are discussed in #1099.
This PR only fixes the second one, because it's not clear what the right UX is for the first issue.

Some things that might not be desirable about this approach.
- it changes the external API, by changing
column=>columnsandother_column=>other_columns(see inline comment for more discussion. - There are various places where the plural foreign keys have to be checked for length and discarded or transformed to singular.
Codecov Report
Base: 92.11% // Head: 92.12% // Increases project coverage by +0.01% :tada:
Coverage data is based on head (
1e5b42f) compared to base (e4ebef0). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #2003 +/- ##
==========================================
+ Coverage 92.11% 92.12% +0.01%
==========================================
Files 38 38
Lines 5555 5565 +10
==========================================
+ Hits 5117 5127 +10
Misses 438 438
| Impacted Files | Coverage Δ | |
|---|---|---|
| datasette/app.py | 94.50% <100.00%> (+0.01%) |
:arrow_up: |
| datasette/filters.py | 95.73% <100.00%> (+0.04%) |
:arrow_up: |
| datasette/utils/__init__.py | 94.89% <100.00%> (+0.02%) |
:arrow_up: |
| datasette/views/row.py | 87.82% <100.00%> (ø) |
|
| datasette/views/table.py | 92.61% <100.00%> (+0.03%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@simonw, let me know what you think about this approach!
see this related discussion to a change in API in sqlite-utils https://github.com/simonw/sqlite-utils/pull/203#issuecomment-753567932