- both date and time, with time zone. Allowed values should be of ISO8601 format. E.g. 2016-07-20T17:30:15Z, 2016-07-20T17:30:15+05:30, 2016-07-20T17:30:15.234890+05:30
* - ``time with time zone``
-``timetz``
- time of day only, with time zone. Allowed values should be of ISO8601 format. E.g. 17:30:15Z, 17:30:15+05:30, 17:30:15.234890+05:30
* - ``date``
-
- date (no time of day). Allowed values are yyyy-mm-dd
4. Boolean type
..list-table::
:widths:8 6 20
:header-rows:1
* - Type
- Alias
- Description
* - ``boolean``
-
- state of true or false
5. JSON types
..list-table::
:widths:8 6 20
:header-rows:1
* - Type
- Alias
- Description
* - ``json``
-
- Stored as plain text
* - ``jsonb``
-
- Stored in a binary format and can be indexed
.._PGColumn:
PGColumn
^^^^^^^^
..parsed-literal::
String
.._RelationshipName:
RelationshipName
^^^^^^^^^^^^^^^^
..parsed-literal::
String
.._table_config:
Table Config
^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - custom_name
- false
-``String``
- Customise the ``<table-name>`` with the provided custom name value.
The GraphQL nodes for the table will be generated according to the custom name.
* - custom_root_fields
- false
-:ref:`Custom Root Fields <custom_root_fields>`
- Customise the root fields
* - custom_column_names
- false
-:ref:`CustomColumnNames`
- Customise the column fields
.._custom_root_fields:
Custom Root Fields
^^^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - select
- false
-``String``
- Customise the ``<table-name>`` root field
* - select_by_pk
- false
-``String``
- Customise the ``<table-name>_by_pk`` root field
* - select_aggregate
- false
-``String``
- Customise the ``<table-name>_aggregete`` root field
* - insert
- false
-``String``
- Customise the ``insert_<table-name>`` root field
* - insert_one
- false
-``String``
- Customise the ``insert_<table-name>_one`` root field
* - update
- false
-``String``
- Customise the ``update_<table-name>`` root field
* - update_by_pk
- false
-``String``
- Customise the ``update_<table-name>_by_pk`` root field
* - delete
- false
-``String``
- Customise the ``delete_<table-name>`` root field
* - delete_by_pk
- false
-``String``
- Customise the ``delete_<table-name>_by_pk`` root field
.._InsertPermission:
InsertPermission
^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - check
- true
-:ref:`BoolExp`
- This expression has to hold true for every new row that is inserted
* - set
- false
-:ref:`ColumnPresetExp`
- Preset values for columns that can be sourced from session variables or static values
* - columns
- false
-:ref:`PGColumn` array (or) ``'*'``
- Can insert into only these columns (or all when ``'*'`` is specified)
* - backend_only
- false
- Boolean
- When set to ``true`` the mutation is accessible only if ``x-hasura-use-backend-only-permissions``
session variable exists and is set to ``true`` and request is made with ``x-hasura-admin-secret``
set if any auth is configured
.._SelectPermission:
SelectPermission
^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - columns
- true
-:ref:`PGColumn` array (or) ``'*'``
- Only these columns are selectable (or all when ``'*'`` is specified)
* - computed_fields
- false
-:ref:`ComputedFieldName` array
- Only these computed fields are selectable
* - filter
- true
-:ref:`BoolExp`
- Only the rows where this expression holds true are selectable
* - limit
- false
-``Integer``
- The maximum number of rows that can be returned
* - allow_aggregations
- false
-``Boolean``
- Toggle allowing aggregate queries
.._UpdatePermission:
UpdatePermission
^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - columns
- true
-:ref:`PGColumn` array (or) ``'*'``
- Only these columns are selectable (or all when ``'*'`` is specified)
* - filter
- true
-:ref:`BoolExp`
- Only the rows where this precondition holds true are updatable
* - check
- false
-:ref:`BoolExp`
- Postcondition which must be satisfied by rows which have been updated
* - set
- false
-:ref:`ColumnPresetExp`
- Preset values for columns that can be sourced from session variables or static values.
.._DeletePermission:
DeletePermission
^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - filter
- true
-:ref:`BoolExp`
- Only the rows where this expression holds true are deletable
(For more details, refer to the Postgres docs for `comparison operators <https://www.postgresql.org/docs/current/functions-comparison.html>`__ and `list based search operators <https://www.postgresql.org/docs/current/functions-comparisons.html>`__.)
**Text related operators :**
..list-table::
:header-rows:1
* - Operator
- PostgreSQL equivalent
* - ``"$like"``
-``LIKE``
* - ``"$nlike"``
-``NOT LIKE``
* - ``"$ilike"``
-``ILIKE``
* - ``"$nilike"``
-``NOT ILIKE``
* - ``"$similar"``
-``SIMILAR TO``
* - ``"$nsimilar"``
-``NOT SIMILAR TO``
* - ``$regex``
-``~``
* - ``$iregex``
-``~*``
* - ``$nregex``
-``!~``
* - ``$niregex``
-``!~*``
(For more details on text related operators, refer to the `Postgres docs <https://www.postgresql.org/docs/current/functions-matching.html>`__.)
**Operators for comparing columns (all column types except json, jsonb):**
..list-table::
:header-rows:1
* - Operator
- PostgreSQL equivalent
* - ``"$ceq"``
-``=``
* - ``"$cne"``
-``<>``
* - ``"$cgt"``
-``>``
* - ``"$clt"``
-``<``
* - ``"$cgte"``
-``>=``
* - ``"$clte"``
-``<=``
(For more details on comparison operators, refer to the `Postgres docs <https://www.postgresql.org/docs/current/functions-comparison.html>`__.)
**Checking for NULL values :**
..list-table::
:header-rows:1
* - Operator
- PostgreSQL equivalent
* - ``_is_null`` (takes true/false as values)
-``IS NULL``
(For more details on the ``IS NULL`` expression, refer to the `Postgres docs <https://www.postgresql.org/docs/current/functions-comparison.html>`__.)
**JSONB operators :**
..list-table::
:header-rows:1
* - Operator
- PostgreSQL equivalent
* - ``_contains``
-``@>``
* - ``_contained_in``
-``<@``
* - ``_has_key``
-``?``
* - ``_has_keys_any``
-``?!``
* - ``_has_keys_all``
-``?&``
(For more details on JSONB operators, refer to the `Postgres docs <https://www.postgresql.org/docs/current/static/functions-json.html#FUNCTIONS-JSONB-OP-TABLE>`__.)
**PostGIS related operators on GEOMETRY columns:**
..list-table::
:header-rows:1
* - Operator
- PostGIS equivalent
* - ``_st_contains``
-``ST_Contains(column, input)``
* - ``_st_crosses``
-``ST_Crosses(column, input)``
* - ``_st_equals``
-``ST_Equals(column, input)``
* - ``_st_intersects``
-``ST_Intersects(column, input)``
* - ``_st_overlaps``
-``ST_Overlaps(column, input)``
* - ``_st_touches``
-``ST_Touches(column, input)``
* - ``_st_within``
-``ST_Within(column, input)``
* - ``_st_d_within``
-``ST_DWithin(column, input)``
(For more details on spatial relationship operators, refer to the `PostGIS docs <http://postgis.net/workshops/postgis-intro/spatial_relationships.html>`__.)
..note::
- All operators take a JSON representation of ``geometry/geography`` values as input value.
- The input value for ``_st_d_within`` operator is an object:
A JSONObject_ of a Postgres column name to value mapping, where the value can be static or derived from a session variable.
..parsed-literal::
:class:haskell-pre
{
"column1" : colVal1,
"column2" : colVal2,
..
}
E.g. where ``id`` is derived from a session variable and ``city`` is a static value.
..code-block:: json
{
"id" : "x-hasura-User-Id",
"city" : "San Francisco"
}
..note::
If the value of any key begins with "x-hasura-" (*case-insensitive*), the value of the column specified in the key will be derived from a session variable of the same name.
.._RemoteSchemaName:
RemoteSchemaName
^^^^^^^^^^^^^^^^
..parsed-literal::
String
.._RemoteSchemaDef:
RemoteSchemaDef
^^^^^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
{
"url" : url-string,
"url_from_env" : env-var-string,
"headers": [
{ "name": header-name-string,
"value": header-value-string,
"value_from_env": env-var-string
}
],
"forward_client_headers": boolean,
"timeout_seconds": integer
}
.._CollectionName:
CollectionName
^^^^^^^^^^^^^^
..parsed-literal::
String
.._QueryName:
QueryName
^^^^^^^^^
..parsed-literal::
String
.._CollectionQuery:
CollectionQuery
^^^^^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
{
"name": String,
"query": String
}
.._EndpointUrl:
EndpointUrl
^^^^^^^^^^^
..parsed-literal::
String
.._EndpointMethods:
EndpointMethods
^^^^^^^^^^^^^^^
..parsed-literal::
[String]
.._EndpointDef:
EndpointDefinition
^^^^^^^^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
{
"query": {
"query_name : String,
"collection_name" : CollectionName
}
}
.._CustomColumnNames:
CustomColumnNames
^^^^^^^^^^^^^^^^^
A JSONObject_ of Postgres column name to GraphQL name mapping
..parsed-literal::
:class:haskell-pre
{
"column1" : String,
"column2" : String,
..
}
.._ActionName:
ActionName
^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
String
.._WebhookURL:
WebhookURL
^^^^^^^^^^
A String value which supports templating environment variables enclosed in ``{{`` and ``}}``.
-**Function behaviour**: ``STABLE`` or ``IMMUTABLE`` functions may *only* be exposed as queries (i.e. with ``exposed_as: query``)
``VOLATILE`` functions may be exposed as mutations or queries.
-**Return type**: MUST be ``SETOF <table-name>`` OR ``<table_name>`` where ``<table-name>`` is already tracked
-**Argument modes**: ONLY ``IN``
.._InputObjectType:
InputObjectType
^^^^^^^^^^^^^^^
A simple JSON object to define `GraphQL Input Object <https://spec.graphql.org/June2018/#sec-Input-Objects>`__
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Input object type
* - description
- false
- String
- Description of the Input object type
* - fields
- true
- Array of InputObjectField_
- Fields of the Input object type
.._InputObjectField:
InputObjectField
****************
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Input object field
* - description
- false
- String
- Description of the Input object field
* - type
- true
-:ref:`GraphQLType <GraphQLType>`
- GraphQL ype of the input object field
.._ObjectType:
ObjectType
^^^^^^^^^^
A simple JSON object to define `GraphQL Object <https://spec.graphql.org/June2018/#sec-Objects>`__
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Object type
* - description
- false
- String
- Description of the Object type
* - fields
- true
- Array of ObjectField_
- Fields of the Object type
* - relationships
- false
- Array of ObjectRelationship_
- Relationships of the Object type to tables
.._ObjectField:
ObjectField
***********
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Input object field
* - description
- false
- String
- Description of the Input object field
* - type
- true
-:ref:`GraphQLType <GraphQLType>`
- GraphQL type of the input object field
.._ObjectRelationship:
ObjectRelationship
******************
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`RelationshipName`
- Name of the relationship, shouldn't conflict with existing field names
* - type
- true
- [ ``object`` | ``array`` ]
- Type of the relationship
* - remote_table
- true
-:ref:`TableName`
- The table to which relationship is defined
* - field_mapping
- true
- Object (ObjectField_ name : Remote table's :ref:`PGColumn`)
- Mapping of fields of object type to columns of remote table
.._ScalarType:
ScalarType
^^^^^^^^^^
A simple JSON object to define `GraphQL Scalar <https://spec.graphql.org/June2018/#sec-Scalars>`__
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Scalar type
* - description
- false
- String
- Description of the Scalar type
.._EnumType:
EnumType
^^^^^^^^
A simple JSON object to define `GraphQL Enum <https://spec.graphql.org/June2018/#sec-Enums>`__
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - name
- true
-:ref:`GraphQLName`
- Name of the Enum type
* - description
- false
- String
- Description of the Enum type
* - values
- true
- Array of EnumValue_
- Values of the Enum type
.._EnumValue:
EnumValue
*********
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - value
- true
-:ref:`GraphQLName`
- Value of the Enum type
* - description
- false
- String
- Description of the value
* - is_deprecated
- false
- Boolean
- If set to ``true``, the enum value is marked as deprecated
.._TriggerName:
TriggerName
^^^^^^^^^^^
..parsed-literal::
String
.._OperationSpec:
OperationSpec
^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - columns
- true
- EventTriggerColumns_
- List of columns or "*" to listen to changes
* - payload
- false
- EventTriggerColumns_
- List of columns or "*" to send as part of webhook payload
.._EventTriggerColumns:
EventTriggerColumns
^^^^^^^^^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
"*" | [:ref:`PGColumn`]
.._RetryConf:
RetryConf
^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- required
- Schema
- Description
* - num_retries
- false
- Integer
- Number of times to retry delivery. Default: 0
* - interval_sec
- false
- Integer
- Number of seconds to wait between each retry. Default: 10
* - timeout_sec
- false
- Integer
- Number of seconds to wait for response before timing out. Default: 60
.._RemoteRelationshipName:
RemoteRelationshipName
^^^^^^^^^^^^^^^^^^^^^^
..parsed-literal::
String
.._RemoteField:
RemoteField
^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
{
FieldName: {
"arguments": InputArguments
"field": RemoteField # optional
}
}
``RemoteField`` is a recursive tree structure that points to the field in the remote schema that needs to be joined with. It is recursive because the remote field maybe nested deeply in the remote schema.
Examples:
..code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"message": {
"arguments":{
"message_id":"$id"
}
}
}
..code-block:: http
POST /v1/query HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"messages": {
"arguments": {
"limit": 100
},
"field": {
"private": {
"arguments": {
"id" : "$id"
}
}
}
}
}
InputArguments
^^^^^^^^^^^^^^
..parsed-literal::
:class:haskell-pre
{
InputField : $PGColumn | Scalar
}
Table columns can be referred by prefixing ``$`` e.g ``$id``.
.._RemoteSchemaPermission:
RemoteSchemaPermission
^^^^^^^^^^^^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- Required
- Schema
- Description
* - schema
- true
- GraphQL SDL
- GraphQL SDL defining the role based schema
UrlFromEnv
^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- required
- Schema
- Description
* - from_env
- true
- String
- Name of the environment variable which has the URL
.._RetryConfST:
RetryConfST
^^^^^^^^^^^
..list-table::
:header-rows:1
* - Key
- required
- Schema
- Description
* - num_retries
- false
- Integer
- Number of times to retry delivery. Default: 0
* - retry_interval_seconds
- false
- Integer
- Number of seconds to wait between each retry. Default: 10
* - timeout_seconds
- false
- Integer
- Number of seconds to wait for response before timing out. Default: 60
* - tolerance_seconds
- false
- Integer
- Number of seconds between scheduled time and actual delivery time that is acceptable. If the time difference is more than this, then the event is dropped. Default: 21600 (6 hours)