mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Improved docs for db.get_all_foreign_keys()
This commit is contained in:
parent
da209ed2ba
commit
7945f4fbf2
1 changed files with 49 additions and 12 deletions
|
|
@ -1294,27 +1294,64 @@ The ``Database`` class also provides properties and methods for introspecting th
|
||||||
Returns the SQL definition of the named view.
|
Returns the SQL definition of the named view.
|
||||||
|
|
||||||
``await db.get_all_foreign_keys()`` - dictionary
|
``await db.get_all_foreign_keys()`` - dictionary
|
||||||
Dictionary representing both incoming and outgoing foreign keys for this table. It has two keys, ``"incoming"`` and ``"outgoing"``, each of which is a list of dictionaries with keys ``"column"``, ``"other_table"`` and ``"other_column"``. For example:
|
Dictionary representing both incoming and outgoing foreign keys for every table in this database. Each key is a table name that points to a dictionary with two keys, ``"incoming"`` and ``"outgoing"``, each of which is a list of dictionaries with keys ``"column"``, ``"other_table"`` and ``"other_column"``. For example:
|
||||||
|
|
||||||
.. code-block:: json
|
.. code-block:: json
|
||||||
|
|
||||||
{
|
{
|
||||||
|
"documents": {
|
||||||
|
"incoming": [
|
||||||
|
{
|
||||||
|
"other_table": "pages",
|
||||||
|
"column": "id",
|
||||||
|
"other_column": "document_id"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outgoing": []
|
||||||
|
},
|
||||||
|
"pages": {
|
||||||
|
"incoming": [
|
||||||
|
{
|
||||||
|
"other_table": "organization_pages",
|
||||||
|
"column": "id",
|
||||||
|
"other_column": "page_id"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outgoing": [
|
||||||
|
{
|
||||||
|
"other_table": "documents",
|
||||||
|
"column": "document_id",
|
||||||
|
"other_column": "id"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"organization": {
|
||||||
|
"incoming": [
|
||||||
|
{
|
||||||
|
"other_table": "organization_pages",
|
||||||
|
"column": "id",
|
||||||
|
"other_column": "organization_id"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outgoing": []
|
||||||
|
},
|
||||||
|
"organization_pages": {
|
||||||
"incoming": [],
|
"incoming": [],
|
||||||
"outgoing": [
|
"outgoing": [
|
||||||
{
|
{
|
||||||
"other_table": "attraction_characteristic",
|
"other_table": "pages",
|
||||||
"column": "characteristic_id",
|
"column": "page_id",
|
||||||
"other_column": "pk",
|
"other_column": "id"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"other_table": "roadside_attractions",
|
"other_table": "organization",
|
||||||
"column": "attraction_id",
|
"column": "organization_id",
|
||||||
"other_column": "pk",
|
"other_column": "id"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.. _internals_csrf:
|
.. _internals_csrf:
|
||||||
|
|
||||||
CSRF protection
|
CSRF protection
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue