docs: update with misc 2.0 changes

- update copyright
- fix typo: comparision -> comparison
- add new null in comparision exp behaviour
- update cloud read replica page

GitOrigin-RevId: bfd322344e7ecf89a2c1361db4bc2d7e25718b98
This commit is contained in:
Rikin Kachhia 2021-03-24 22:07:27 +05:30 committed by hasura-bot
parent e0ec670b05
commit 4815c2bbc8
4 changed files with 102 additions and 22 deletions

View File

@ -335,7 +335,7 @@
</div>
<div>
Powered by <a target="_blank" rel="noopener" href="http://www.sphinx-doc.org">Sphinx</a>.
| Copyright &copy; 2020 <a target="_blank" rel="noopener" href="https://hasura.io">Hasura</a>.
| Copyright &copy; 2021 <a target="_blank" rel="noopener" href="https://hasura.io">Hasura</a>.
</div>
</div>
</div>

View File

@ -20,23 +20,91 @@ Hasura Cloud can load balance queries and subscriptions across read replicas whi
Adding read replica urls
------------------------
If you have configured your Postgres instances with replicas, the replica URLs can be added to Hasura using the following environment variable in your project ENV Vars tab:
.. rst-class:: api_tabs
.. tabs::
.. code-block:: bash
.. tab:: Console
HASURA_GRAPHQL_READ_REPLICA_URLS=postgres://user:password@replica-host:5432/db
Support coming very soon
If you have multiple replicas, their urls can be added as comma separated values.
.. tab:: CLI
Connection pool parameters
--------------------------
You can add read replicas for a database by adding their config to the ``/metadata/databases/database.yaml`` file:
Additional environment variables for connection pools, and for read replicas specifically:
.. code-block:: yaml
:emphasize-lines: 11-17
``HASURA_GRAPHQL_PG_STRIPES``
- name: <db-name>
kind: postgres
configuration:
connection_info:
database_url:
from_env: <DATABASE_URL_ENV>
pool_settings:
idle_timeout: 180
max_connections: 50
retries: 1
read_replicas:
- database_url:
from_env: <DATABASE_REPLICA_URL_ENV>
pool_settings:
idle_timeout: 180
max_connections: 50
retries: 1
``HASURA_GRAPHQL_PG_CONNECTIONS``
Apply the metadata by running:
``HASURA_GRAPHQL_CONNECTIONS_PER_READ_REPLICA``
.. code-block:: yaml
``HASURA_GRAPHQL_STRIPES_PER_READ_REPLICA``
hasura metadata apply
.. tab:: API
Currently it is only possible to add read replicas for a database at the time of creation using the :ref:`pg_add_source metadata API <pg_add_source>`
.. code-block:: http
:emphasize-lines: 15-26
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "pg_add_source",
"args": {
"name": "<db_name>",
"configuration": {
"connection_info": {
"database_url": {
"from_env": "<DATABASE_URL_ENV>"
}
},
"read_replicas": [
{
"database_url": {
"from_env": "<DATABASE_REPLICA_URL_ENV>"
},
"pool_settings": {
"retries": 1,
"idle_timeout": 180,
"max_connections": 50
}
}
]
}
.. admonition:: For existing v1.3 projects
If you have configured your Postgres instances with replicas, the replica URLs can be added to Hasura using the following environment variable in your project ENV Vars tab:
.. code-block:: bash
HASURA_GRAPHQL_READ_REPLICA_URLS=postgres://user:password@replica-host:5432/db
If you have multiple replicas, their urls can be added as comma separated values.
Additional environment variables for read replicas specifically:
``HASURA_GRAPHQL_CONNECTIONS_PER_READ_REPLICA``
``HASURA_GRAPHQL_STRIPES_PER_READ_REPLICA``

View File

@ -81,7 +81,7 @@ engine instance via the console / metadata APIs / CLI:
.. code-block:: http
POST /v2/metadata HTTP/1.1
POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
@ -93,6 +93,11 @@ engine instance via the console / metadata APIs / CLI:
"connection_info": {
"database_url": {
"from_env": "<DB_URL_ENV_VAR>"
},
"pool_settings": {
"retries": 1,
"idle_timeout": 180,
"max_connections": 50
}
}
}

View File

@ -57,10 +57,10 @@ argument to filter on equality.
You can see the complete specification of the ``where`` argument in the :ref:`API reference <WhereExp>`.
Comparision operators
---------------------
Comparison operators
--------------------
Lets take a look at different comparision operators that can be used to filter results.
Lets take a look at different comparison operators that can be used to filter results.
Equality operators (_eq, _neq)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -1267,7 +1267,7 @@ For example:
}
}
The behaviour of the comparision operators depends on whether the nested objects are a single object related via an
The behaviour of the comparison operators depends on whether the nested objects are a single object related via an
object relationship or an array of objects related via an array relationship.
- In case of an **object relationship**, a row will be returned if the single nested object satisfies the defined
@ -1826,10 +1826,17 @@ The expression ``{}`` evaluates to ``true`` if an object exists (even if it's ``
.. _null_value_evaluation:
Evaluation of **null** values in comparision expressions
--------------------------------------------------------
Evaluation of **null** values in comparison expressions
-------------------------------------------------------
If in any comparision expression a ``null`` (or ``undefined``) value is passed, the expression currently gets
reduced to ``{}`` (:ref:`TRUE expression <true_expression>`)
In **versions v2.0.0 and above**, if in any comparison expression a ``null`` value is passed, a type mismatch error
will be thrown.
**For example**, the expression ``{ where: { _eq: null } }`` will be reduced to ``{ where: {} }``
For example, the expression ``{ where: {id: { _eq: null }}}`` will throw an error.
In **versions v1.3.3 and below**, if in any comparison expression a ``null`` value is passed, the expression gets
reduced to ``{}``, the :ref:`TRUE expression <true_expression>`.
For example, the expression ``{ where: { id: {_eq: null }}}`` will be reduced to ``{ where: {id: {}} }`` which
will return all objects for which an ``id`` is set, i.e. all objects will be returned.