graphql-engine/server/tests-py/queries/graphql_query
Antoine Leblanc eaba2e08d3 Clean Relay's code, break schema cycles, introduce Node ID V2
## Motivation

This PR rewrites most of Relay to achieve the following:
- ~~fix a bug in which the same node id could refer to two different tables in the schema~~
- remove one of the few remaining uses of the source cache in the schema building code

In doing so, it also:
- simplifies the `BackendSchema` class by removing `node` from it,
- makes it much easier for other backends to support Relay,
- documents, re-organizes, and clarifies the code.

## Description

This PR introduces a new `NodeId` version ~~, and adapts the Postgres code to always generate this V2 version~~. This new id contains the source name, in addition to the table name, in order to disambiguate similar table names across different sources (which is now possible with source customization). In doing so, it now explicitly handles that case for V1 node ids, and returns an explicit error message instead of running the risk of _silently returning the wrong information_.

Furthermore, it adapts `nodeField` to support multiple backends; most of the code was trivial to generalize, and as a result it lowers the cost of entry for other backends, that now only need to support `AFNodeId` in their translation layer.

Finally, it removes one more cycle in the schema building code, by using the same trick we used for remote relationships instead of using the memoization trick of #4576.

## Remaining work

- ~~[ ]write a Changelog entry~~
- ~~[x] adapt all tests that were asserting on an old node id~~

## Future work

This PR was adapted from its original form to avoid a breaking change: while it introduces a Node ID V2, we keep generating V1 IDs and the parser rejects V2 IDs. It will be easy to make the switch at a later data in a subsequent PR.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/4593
GitOrigin-RevId: 88e5cb91e8b0646900547fa8c7c0e1463de267a1
2022-06-07 13:36:29 +00:00
..
agg_perm server/mssql: fix SQL generation for aggregation queries in sql server (fixes #7773 & #7871) 2021-12-02 14:22:42 +00:00
aggregations server: add type information to aggregates and stringify them (closes #5704) 2021-01-18 13:52:51 +00:00
allowlist server: validate top level fragments in GQL query 2022-04-20 07:33:21 +00:00
allowlist_role_based server: add validation for query collections 2022-03-08 09:49:18 +00:00
basic server: use placeholder to prevent empty query roots 2022-01-27 18:08:11 +00:00
bigquery server/tests: unify HASURA_BIGQUERY_SERVICE_KEY and HASURA_BIGQUERY_SERVICE_ACCOUNT env vars 2022-03-14 07:50:35 +00:00
boolexp Add _cast support for other postgres datatypes fix #6050 and fix #5426 2022-06-01 16:41:49 +00:00
caching [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
citus server: fix failing citus test 2021-07-21 15:28:32 +00:00
computed_fields server/postgres: add test case to test computed field with session argument in where expression 2021-09-30 11:27:37 +00:00
custom_schema [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
empty server: use placeholder to prevent empty query roots 2022-01-27 18:08:11 +00:00
enums [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
functions Correctly translate permissions on functions to SQL, and simplify Bool Exp IR 2021-10-18 09:17:42 +00:00
limits server: introduce new custom scalars and remove offsetParser 2021-06-10 16:14:21 +00:00
mysql server: deduplicate some pytests 2021-11-26 19:38:17 +00:00
offset [server] coalesce multiple run_sql calls in tests (#270) 2021-01-06 16:07:22 +00:00
order_by server/postgres: support computed fields in order by 2021-07-27 16:28:23 +00:00
permissions BigQuery remote joins 2021-11-24 16:22:55 +00:00
read_only_source server: remove hdb_lib and add tests for read-only source 2022-02-21 10:00:00 +00:00
relay Clean Relay's code, break schema cycles, introduce Node ID V2 2022-06-07 13:36:29 +00:00
v1alpha1/errors Integration test improvements (for speed/clarity), also increase polling interval for scheduled events 2021-04-27 05:35:26 +00:00