Schema/Metadata API Reference: Common syntax definitions

TableName

String | QualifiedTable

QualifiedTable

{
        "name": String,
        "schema": String
}

FunctionName

String | QualifiedFunction

QualifiedFunction

{
        "name": String,
        "schema": String
}

RoleName

String

PGColumnType

String
  1. Numeric types

    Type Alias Description
    serial   autoincrementing integer
    bigserial   autoincrementing bigint
    integer   4 bytes, typical choice for integer
    smallint   2 bytes
    bigint   8 bytes
    real float4 6 decimal digits precision, inexact
    double precision float8 15 decimal digits precision, inexact
    numeric decimal arbitrary precision, exact
  2. Character types

    Type Alias Description
    varchar text typical choice for storing string types
  3. Date/Time types

    Type Alias Description
    timestamp with time zone timestamptz 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

    Type Alias Description
    boolean   state of true or false
  5. JSON types

    Type Alias Description
    json   Stored as plain text
    jsonb   Stored in a binary format and can be indexed

PGColumn

String

RelationshipName

String

AndExp

{
    "$and" : [BoolExp],
}

OrExp

{
    "$or"  : [BoolExp],
}

NotExp

{
    "$not" : BoolExp
}

TrueExp

 {}

ColumnExp

{
    PGColumn : { Operator : Value }
}

Operator

Generic operators (all column types except json, jsonb) :

  • "$eq"
  • "$ne"
  • "$in"
  • "$nin"
  • "$gt"
  • "$lt"
  • "$gte"
  • "$lte"

Text related operators :

  • "$like"
  • "$nlike"
  • "$ilike"
  • "$nilike"
  • "$similar"
  • "$nsimilar"

Operators for comparing columns (all column types except json, jsonb):

  • "$ceq"
  • "$cne"
  • "$cgt"
  • "$clt"
  • "$cgte"
  • "$clte"

Checking for NULL values :

  • _is_null (takes true/false as values)

JSONB operators :

Operator PostgreSQL equivalent
_contains @>
_contained_in <@
_has_key ?
_has_keys_any ?|
_has_keys_all ?&

(For more details on what these operators do, refer to Postgres docs.)

PostGIS related operators on GEOMETRY columns:

Operator PostGIS equivalent
_st_contains ST_Contains
_st_crosses ST_Crosses
_st_equals ST_Equals
_st_intersects ST_Intersects
_st_overlaps ST_Overlaps
_st_touches ST_Touches
_st_within ST_Within
_st_d_within ST_DWithin

(For more details on what these operators do, refer to PostGIS docs.)

Note

  • All operators take a JSON representation of geometry/geography values as input value.

  • Input value for _st_d_within operator is an object:

    {
      field-name : {_st_d_within: {distance: Float, from: Value} }
    }
    

Object

A JSONObject

{
   "k1" : v1,
   "k2" : v2,
   ..
}

Empty Object

An empty JSONObject

{}

ColumnPresetsExp

A JSONObject of Postgres column name to value mapping, where value can be static or derived from a session variable.

{
   "column1" : colVal1,
   "column2" : colVal2,
   ..
}

E.g. where id is derived from session variable and city is a static value.

{
   "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

String

RemoteSchemaDef

{
   "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
}

CollectionName

String

QueryName

String

CollectionQuery

{
    "name": String,
    "query": String
}