2021-10-29 17:42:07 +03:00
|
|
|
- description: PG add source
|
|
|
|
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:
|
|
|
|
customization:
|
|
|
|
root_fields:
|
|
|
|
namespace: my_source
|
|
|
|
prefix: fpref_
|
|
|
|
suffix: _fsuff
|
|
|
|
type_names:
|
|
|
|
prefix: tpref_
|
|
|
|
suffix: _tsuff
|
|
|
|
|
|
|
|
- description: create table 1
|
|
|
|
url: /v1/query
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
result_type: CommandOk
|
|
|
|
result:
|
|
|
|
query:
|
|
|
|
type: run_sql
|
|
|
|
args:
|
|
|
|
source: pg1
|
|
|
|
sql: |
|
2021-11-26 14:39:25 +03:00
|
|
|
create table author_local(
|
2021-10-29 17:42:07 +03:00
|
|
|
id serial primary key,
|
|
|
|
name text unique
|
|
|
|
);
|
2021-11-26 14:39:25 +03:00
|
|
|
INSERT INTO author_local (name)
|
2021-10-29 17:42:07 +03:00
|
|
|
VALUES ('Author 1'), ('Author 2');
|
|
|
|
|
|
|
|
- description: track table
|
|
|
|
url: /v1/metadata
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
message: success
|
|
|
|
query:
|
|
|
|
type: pg_track_table
|
|
|
|
args:
|
2021-11-26 14:39:25 +03:00
|
|
|
table: author_local
|
2021-10-29 17:42:07 +03:00
|
|
|
source: pg1
|
|
|
|
|
|
|
|
|
|
|
|
- description: Simple GraphQL query to fetch items from the source table
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
my_source:
|
|
|
|
__typename: tpref_my_source_query_tsuff
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_fsuff:
|
2021-10-29 17:42:07 +03:00
|
|
|
- id: 1
|
|
|
|
name: 'Author 1'
|
2021-11-26 14:39:25 +03:00
|
|
|
__typename: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
- id: 2
|
|
|
|
name: 'Author 2'
|
2021-11-26 14:39:25 +03:00
|
|
|
__typename: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
my_source {
|
|
|
|
__typename
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_fsuff {
|
2021-10-29 17:42:07 +03:00
|
|
|
id
|
|
|
|
name
|
|
|
|
__typename
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- description: Simple GraphQL query with field aliases to fetch items from the source table
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
a:
|
|
|
|
b: tpref_my_source_query_tsuff
|
|
|
|
c:
|
|
|
|
- d: 1
|
|
|
|
e: 'Author 1'
|
2021-11-26 14:39:25 +03:00
|
|
|
f: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
- d: 2
|
|
|
|
e: 'Author 2'
|
2021-11-26 14:39:25 +03:00
|
|
|
f: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
a: my_source {
|
|
|
|
b: __typename
|
2021-11-26 14:39:25 +03:00
|
|
|
c: fpref_author_local_fsuff {
|
2021-10-29 17:42:07 +03:00
|
|
|
d: id
|
|
|
|
e: name
|
|
|
|
f: __typename
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- description: Lookup by pk
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
my_source:
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_by_pk_fsuff:
|
2021-10-29 17:42:07 +03:00
|
|
|
id: 1
|
|
|
|
name: 'Author 1'
|
2021-11-26 14:39:25 +03:00
|
|
|
__typename: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
query {
|
|
|
|
my_source {
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_by_pk_fsuff(id: 1) {
|
2021-10-29 17:42:07 +03:00
|
|
|
id
|
|
|
|
name
|
|
|
|
__typename
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- description: Aggregate
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
my_source:
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_aggregate_fsuff:
|
|
|
|
__typename: tpref_author_local_aggregate_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
aggregate:
|
2021-11-26 14:39:25 +03:00
|
|
|
__typename: tpref_author_local_aggregate_fields_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
count: 1
|
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
query MyQuery {
|
|
|
|
my_source {
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_author_local_aggregate_fsuff(where: {name: {_eq: "Author 2"}}) {
|
2021-10-29 17:42:07 +03:00
|
|
|
__typename
|
|
|
|
aggregate {
|
|
|
|
__typename
|
|
|
|
count
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- description: Insert
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
my_source:
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_insert_author_local_fsuff:
|
|
|
|
__typename: tpref_author_local_mutation_response_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
returning:
|
2021-11-26 14:39:25 +03:00
|
|
|
- __typename: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
id: 3
|
|
|
|
name: Author 3
|
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
mutation MyMutation {
|
|
|
|
my_source {
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_insert_author_local_fsuff(objects: {name: "Author 3", id: 3}) {
|
2021-10-29 17:42:07 +03:00
|
|
|
__typename
|
|
|
|
returning {
|
|
|
|
__typename
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- description: Delete by pk
|
|
|
|
url: /v1/graphql
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
data:
|
|
|
|
my_source:
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_delete_author_local_by_pk_fsuff:
|
|
|
|
__typename: tpref_author_local_tsuff
|
2021-10-29 17:42:07 +03:00
|
|
|
id: 3
|
|
|
|
name: Author 3
|
|
|
|
query:
|
|
|
|
query: |
|
|
|
|
mutation MyMutation {
|
|
|
|
my_source {
|
2021-11-26 14:39:25 +03:00
|
|
|
fpref_delete_author_local_by_pk_fsuff(id: 3) {
|
2021-10-29 17:42:07 +03:00
|
|
|
__typename
|
|
|
|
id
|
|
|
|
name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
- description: untrack table
|
|
|
|
url: /v1/metadata
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
message: success
|
|
|
|
query:
|
|
|
|
type: pg_untrack_table
|
|
|
|
args:
|
2021-11-26 14:39:25 +03:00
|
|
|
table: author_local
|
2021-10-29 17:42:07 +03:00
|
|
|
source: pg1
|
|
|
|
|
|
|
|
- description: drop table
|
|
|
|
url: /v1/query
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
result_type: CommandOk
|
|
|
|
result:
|
|
|
|
query:
|
|
|
|
type: run_sql
|
|
|
|
args:
|
|
|
|
source: pg1
|
|
|
|
sql: |
|
2021-11-26 14:39:25 +03:00
|
|
|
drop table author_local;
|
2021-10-29 17:42:07 +03:00
|
|
|
|
|
|
|
- description: PG Drop Source 1
|
|
|
|
url: /v1/metadata
|
|
|
|
status: 200
|
|
|
|
response:
|
|
|
|
message: success
|
|
|
|
query:
|
|
|
|
type: pg_drop_source
|
|
|
|
args:
|
|
|
|
name: pg1
|