graphql-engine/server/tests-py/queries/v1/metadata/pg_track_table_source.yaml
2021-08-19 10:28:49 +00:00

114 lines
2.1 KiB
YAML

- 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: 1
- description: create table
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');
create function search_authors(search text)
returns setof author_s1 as $$
select *
from author_s1
where
name ilike ('%' || search || '%');
$$ language sql stable;
- description: track table
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_track_table
args:
table: author_s1
source: pg1
- description: track function
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_track_function
args:
function:
schema: public
name: search_authors
source: pg1
- description: untrack function
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_untrack_function
args:
function:
schema: public
name: search_authors
source: pg1
- description: untrack table
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_untrack_table
args:
table: author_s1
source: pg1
- description: drop table
url: /v1/query
status: 200
response:
result_type: CommandOk
result:
query:
type: run_sql
args:
source: pg1
sql: |
drop table author_s1 cascade;
- description: PG Drop Source
url: /v1/metadata
status: 200
response:
message: success
query:
type: pg_drop_source
args:
name: pg1