graphql-engine/server/tests-py/queries/v1/relationships/object_relationship_manual.yaml

150 lines
3.0 KiB
YAML

#Create object relationship
- description: Create object relationship using manual method
url: /v1/query
status: 200
response:
message: success
query:
type: create_object_relationship
args:
table: article_view
name: author
using:
manual_configuration:
remote_table: author_view
column_mapping:
author_id : id
- description: Nested select on article
url: /v1/query
status: 200
response:
- id: 1
title: Article 1
content: Sample article content 1
author:
id: 1
name: AUTHOR 1
- id: 2
title: Article 2
content: Sample article content 2
author:
id: 1
name: AUTHOR 1
- id: 3
title: Article 3
content: Sample article content 3
author:
id: 2
name: AUTHOR 2
query:
type: select
args:
table: article_view
columns:
- id
- title
- content
- name: author
columns:
- id
- name
#Rename object relationship
- description: Rename object relationship author to author_obj
url: /v1/query
status: 200
response:
message: success
query:
type: rename_relationship
args:
table: article_view
name: author
new_name: author_obj
#Select Query
- description: Nested select on article with renamed object relation
url: /v1/query
status: 200
response:
- id: 1
title: Article 1
content: Sample article content 1
author_obj:
id: 1
name: AUTHOR 1
- id: 2
title: Article 2
content: Sample article content 2
author_obj:
id: 1
name: AUTHOR 1
- id: 3
title: Article 3
content: Sample article content 3
author_obj:
id: 2
name: AUTHOR 2
query:
type: select
args:
table: article_view
columns:
- id
- title
- content
- name: author_obj
columns:
- id
- name
- description: Rename the remote table
url: /v1/query
status: 200
query:
type: run_sql
args:
sql: |
ALTER TABLE author_view RENAME TO authors_view;
- description: Rename the original table/view
url: /v1/query
status: 200
query:
type: run_sql
args:
sql: |
ALTER TABLE article_view RENAME TO articles_view;
- description: Rename tables back to the original name for the teardown process
url: /v1/query
status: 200
query:
type: run_sql
args:
sql: |
ALTER VIEW authors_view RENAME TO author_view;
- description: Rename tables back to the original name for the teardown process
url: /v1/query
status: 200
query:
type: run_sql
args:
sql: |
ALTER VIEW articles_view RENAME TO article_view;
#Drop object relationship
- description: Drop object relationship
url: /v1/query
status: 200
response:
message: success
query:
type: drop_relationship
args:
table: article_view
relationship: author_obj