mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 09:22:43 +03:00
aac64f2c81
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/1616 GitOrigin-RevId: f7eefd2367929209aa77895ea585e96a99a78d47
215 lines
4.0 KiB
YAML
215 lines
4.0 KiB
YAML
- description: PG add source 1
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_add_source
|
|
args:
|
|
name: pg1
|
|
configuration:
|
|
connection_info:
|
|
database_url:
|
|
from_env: HASURA_GRAPHQL_PG_SOURCE_URL_1
|
|
pool_settings:
|
|
max_connections: 50
|
|
idle_timeout: 180
|
|
retries: 1
|
|
|
|
- description: create table 1
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
result_type: CommandOk
|
|
result:
|
|
query:
|
|
type: run_sql
|
|
args:
|
|
source: pg1
|
|
sql: |
|
|
create table author_s1(
|
|
id serial primary key,
|
|
name text unique
|
|
);
|
|
INSERT INTO author_s1 (name)
|
|
VALUES ('Author 1'), ('Author 2');
|
|
|
|
- description: track table 1
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_track_table
|
|
args:
|
|
table: author_s1
|
|
source: pg1
|
|
|
|
- description: PG add source 2
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_add_source
|
|
args:
|
|
name: pg2
|
|
configuration:
|
|
connection_info:
|
|
database_url:
|
|
from_env: HASURA_GRAPHQL_PG_SOURCE_URL_2
|
|
pool_settings:
|
|
max_connections: 50
|
|
idle_timeout: 180
|
|
retries: 1
|
|
|
|
- description: create table 2
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
result_type: CommandOk
|
|
result:
|
|
query:
|
|
type: run_sql
|
|
args:
|
|
source: pg2
|
|
sql: |
|
|
create table author_s2(
|
|
id serial primary key,
|
|
location text unique
|
|
);
|
|
INSERT INTO author_s2 (location)
|
|
VALUES ('Location 1'), ('Location 2');
|
|
|
|
- description: track table 2
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_track_table
|
|
args:
|
|
table: author_s2
|
|
source: pg2
|
|
|
|
- description: create remote relationship
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_create_remote_relationship
|
|
args:
|
|
name: author_location
|
|
source: pg1
|
|
table: author_s1
|
|
remote_source:
|
|
relationship_type: object
|
|
field_mapping:
|
|
id: id
|
|
source: pg2
|
|
table: author_s2
|
|
|
|
- description: Query using remote relationship
|
|
url: /v1/graphql
|
|
status: 200
|
|
response:
|
|
data:
|
|
author_s1:
|
|
- __typename: author_s1
|
|
author_location:
|
|
__typename: author_s2
|
|
location: Location 1
|
|
id: 1
|
|
name: Author 1
|
|
id: 1
|
|
- __typename: author_s1
|
|
author_location:
|
|
__typename: author_s2
|
|
location: Location 2
|
|
id: 2
|
|
name: Author 2
|
|
id: 2
|
|
query:
|
|
query: |
|
|
query MyQuery {
|
|
author_s1 {
|
|
__typename
|
|
author_location {
|
|
__typename
|
|
location
|
|
id
|
|
}
|
|
name
|
|
id
|
|
}
|
|
}
|
|
|
|
- description: untrack table 1
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_untrack_table
|
|
args:
|
|
table: author_s1
|
|
source: pg1
|
|
|
|
- description: drop table 1
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
result_type: CommandOk
|
|
result:
|
|
query:
|
|
type: run_sql
|
|
args:
|
|
source: pg1
|
|
sql: |
|
|
drop table author_s1;
|
|
|
|
- description: PG Drop Source 1
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_drop_source
|
|
args:
|
|
name: pg1
|
|
|
|
- description: untrack table 2
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_untrack_table
|
|
args:
|
|
table: author_s2
|
|
source: pg2
|
|
|
|
- description: drop table 2
|
|
url: /v1/query
|
|
status: 200
|
|
response:
|
|
result_type: CommandOk
|
|
result:
|
|
query:
|
|
type: run_sql
|
|
args:
|
|
source: pg2
|
|
sql: |
|
|
drop table author_s2;
|
|
|
|
- description: PG Drop Source 2
|
|
url: /v1/metadata
|
|
status: 200
|
|
response:
|
|
message: success
|
|
query:
|
|
type: pg_drop_source
|
|
args:
|
|
name: pg2
|