document 'track_table' and 'untrack_table' query (close #715) (#777)

This commit is contained in:
Rakesh Emmadi 2018-10-17 10:57:11 +05:30 committed by Shahidh K Muhammed
parent 9818819151
commit 405f5edb34
3 changed files with 101 additions and 1 deletions

View File

@ -61,6 +61,14 @@ The various types of queries are listed in the following table:
- :ref:`run_sql_args <run_sql_syntax>`
- Run SQL directly on Postgres
* - :ref:`track_table`
- :ref:`TableName <TableName>`
- Add a table/view
* - :ref:`untrack_table`
- :ref:`untrack_table_args <untrack_table_syntax>`
- Remove a table/view
* - :ref:`create_object_relationship`
- :ref:`create_object_relationship_args <create_object_relationship_syntax>`
- Define a new object relationship
@ -120,6 +128,7 @@ The various types of queries are listed in the following table:
**See**
- :doc:`Run SQL <run-sql>`
- :doc:`Tables/Views <table-view>`
- :doc:`Relationships <relationship>`
- :doc:`Permissions <permission>`
@ -179,6 +188,7 @@ Error codes
:hidden:
Run SQL <run-sql>
Tables/Views <table-view>
Relationships <relationship>
Permissions <permission>
Syntax definitions <syntax-defs>

View File

@ -8,8 +8,20 @@ TableName
^^^^^^^^^
.. parsed-literal::
:class: haskell-pre
String
String | QualifiedTable_
QualifiedTable
^^^^^^^^^^^^^^
.. parsed-literal::
:class: haskell-pre
{
"name": String,
"schema": String
}
.. _RoleName:

View File

@ -0,0 +1,78 @@
Schema/Metadata API Reference: Tables/Views
============================================
Add or remove a table/view to Hasura GraphQL Engine's metadata using following API.
.. Note::
Only tables/views added to metadata are available for ``querying/mutating/subscribing`` data over **GraphQL** API.
.. _track_table:
track_table
-----------
``track_table`` is used to add a table/view.
Add a table/view ``author``:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "track_table",
"args": {
"schema": "public",
"name": "author"
}
}
.. _untrack_table:
untrack_table
-------------
``untrack_table`` is used to remove a table/view.
Remove a table/view ``author``:
.. code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "untrack_table",
"args": {
"table": {
"schema": "public",
"name": "author"
},
"cascade": true
}
}
.. _untrack_table_syntax:
Args syntax
^^^^^^^^^^^
.. list-table::
:header-rows: 1
* - Key
- Required
- Schema
- Description
* - table
- true
- :ref:`TableName <TableName>`
- Name of the table
* - cascade
- false
- Boolean
- When set to ``true``, the effect (if possible) is cascaded to any metadata dependent objects (relationships, permissions, templates).