-
-
Notifications
You must be signed in to change notification settings - Fork 711
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mechanism for indicating foreign key relationships in the table and query page URLs #620
Comments
Added bonus: this would mean faceting results could be enhanced with a "more" link that points to a custom paginated SQL query - but that query could maintain the ability to expand the labels on foreign keys. |
There are three pieces of information that need to be described here: the column, the other table and the other table column. We already have a piece of API design that is similar to this: the
I'm rethinking this syntax in #621 though to support a non-JSON variant that looks more like this:
|
So for foreign key definitions it could look like this:
Or for columns and table names that themselves contain dots it could be:
The value (before the =) is unambiguous -it's Added bonus: if you're referencing another table's single primary key you can omit the |
This new |
Example URL: /fixtures/facetable?_fk.on_earth=facet_cities.id
I think I should move the Lines 355 to 390 in c2779e5
Moving it to "Given this column containing these values, give me back a dictionary mapping each column and value to a label - Passing in the foreign keys we have calculated as an argument makes sense. |
Refs #620 Also fixed a few places that were calling ds.execute() instead of db.execute()
This may be obsoleted by #1293 - it looks like I may be able to auto-detect these foreign keys for arbitrary queries after all. |
Datasette currently only inflates foreign keys (into names hyperlinks) if it detects them as foreign key constraints in the underlying database.
It would be useful if you could specify additional "foreign keys" using both
metadata.json
and the querystring - similar time how you can pass?_fts_table=x
https://datasette.readthedocs.io/en/stable/full_text_search.html#configuring-full-text-search-for-a-table-or-viewThe text was updated successfully, but these errors were encountered: