2021-04-22 14:31:54 +03:00
|
|
|
type: bulk
|
2021-10-12 20:58:46 +03:00
|
|
|
args:
|
|
|
|
- type: bigquery_run_sql
|
|
|
|
args:
|
|
|
|
source: bigquery
|
|
|
|
sql: |
|
|
|
|
DROP SCHEMA IF EXISTS `regency-polecat-beehive.hasura_test` CASCADE;
|
|
|
|
CREATE SCHEMA `regency-polecat-beehive.hasura_test`;
|
|
|
|
CREATE TABLE `hasura_test.all_types` (
|
|
|
|
`string` STRING,
|
|
|
|
`bytes` BYTES,
|
|
|
|
`integer` INT64,
|
|
|
|
`float` FLOAT64,
|
2021-12-29 20:15:40 +03:00
|
|
|
`special_floats` ARRAY<FLOAT64>,
|
2021-10-12 20:58:46 +03:00
|
|
|
`numeric` NUMERIC,
|
|
|
|
`bignumeric` BIGNUMERIC,
|
|
|
|
`boolean` BOOL,
|
|
|
|
`timestamp` TIMESTAMP,
|
|
|
|
`date` DATE,
|
|
|
|
`time` TIME,
|
|
|
|
`datetime` DATETIME,
|
|
|
|
`geography` GEOGRAPHY
|
|
|
|
);
|
|
|
|
CREATE TABLE `hasura_test.author` (
|
|
|
|
`id` INT64,
|
|
|
|
`name` STRING,
|
|
|
|
`created_at` TIMESTAMP
|
|
|
|
);
|
|
|
|
CREATE TABLE `hasura_test.article` (
|
|
|
|
`id` INT64,
|
|
|
|
`title` STRING,
|
|
|
|
`content` STRING,
|
|
|
|
`author_id` INT64,
|
|
|
|
`is_published` BOOL,
|
|
|
|
`published_on` DATETIME,
|
|
|
|
`created_at` TIMESTAMP
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.all_types` VALUES (
|
|
|
|
"STRING",
|
|
|
|
CODE_POINTS_TO_BYTES([0,1,2,3,4,5]),
|
|
|
|
1,
|
|
|
|
1,
|
2021-12-29 20:15:40 +03:00
|
|
|
-- IEEE_DIVIDE(x, 0) returns Infinity and Infinity/Infinity is NaN
|
|
|
|
[1.23e23, IEEE_DIVIDE(-1, 0), IEEE_DIVIDE(1, 0)/IEEE_DIVIDE(1, 0)],
|
2021-10-12 20:58:46 +03:00
|
|
|
1,
|
|
|
|
1,
|
|
|
|
true,
|
|
|
|
PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:00 2008"),
|
|
|
|
PARSE_DATE("%F", "2000-12-30"),
|
|
|
|
PARSE_TIME("%T", "07:30:00"),
|
|
|
|
PARSE_DATETIME('%Y-%m-%d %H:%M:%S', '1998-10-18 13:45:55'),
|
|
|
|
ST_GEOGPOINT(1, 1)
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.author` VALUES (
|
|
|
|
1, "Author 1", PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:00 2008")
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.author` VALUES (
|
|
|
|
2, "Author 2", PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:00 2008")
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.article` VALUES (
|
|
|
|
1, "Title 1", "Content 1", 1, FALSE, NULL, PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:01 2008")
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.article` VALUES (
|
|
|
|
2, "Title 2", "Content 2", 1, TRUE, PARSE_DATETIME('%Y-%m-%d %H:%M:%S', '1998-10-18 13:45:55'), PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:02 2008")
|
|
|
|
);
|
|
|
|
INSERT INTO `hasura_test.article` VALUES (
|
|
|
|
3, "Title 3", "Content 3", 2, FALSE, NULL, PARSE_TIMESTAMP("%c", "Thu Dec 25 07:30:03 2008")
|
|
|
|
);
|
2022-01-17 13:01:25 +03:00
|
|
|
INSERT INTO `hasura_test.article` VALUES (
|
|
|
|
4, "Title 4", "Content 4", 2, FALSE, NULL, PARSE_TIMESTAMP("%c", "Thu Dec 26 07:31:04 2008")
|
|
|
|
);
|
2021-04-22 14:31:54 +03:00
|
|
|
|
2021-11-24 19:21:59 +03:00
|
|
|
-- a copy for remote joins as we can't have the same table tracked in two sources
|
|
|
|
CREATE TABLE `hasura_test.article2`
|
|
|
|
AS SELECT * FROM `hasura_test.article`;
|
|
|
|
|
2021-10-12 20:58:46 +03:00
|
|
|
-- These are helpful for join/aggregate testing.
|
|
|
|
|
|
|
|
CREATE TABLE hasura_test.Artist (
|
|
|
|
artist_self_id int64,
|
|
|
|
name string);
|
|
|
|
|
|
|
|
CREATE TABLE hasura_test.Album (
|
|
|
|
album_self_id int64,
|
|
|
|
artist_other_id int64,
|
|
|
|
title string);
|
|
|
|
|
|
|
|
INSERT INTO hasura_test.Artist
|
|
|
|
VALUES (1002,
|
|
|
|
"tool" ),
|
|
|
|
(1000,
|
|
|
|
"alice in chains" ),
|
|
|
|
(1001,
|
|
|
|
"nirvana" );
|
|
|
|
|
|
|
|
INSERT INTO hasura_test.Album
|
|
|
|
(album_self_id,
|
|
|
|
title,
|
|
|
|
artist_other_id)
|
|
|
|
VALUES ( 2002,
|
|
|
|
"dirt",
|
|
|
|
1000 ),
|
|
|
|
( 2005,
|
|
|
|
"facelift",
|
|
|
|
1000 ),
|
|
|
|
( 2001,
|
|
|
|
"in utero",
|
|
|
|
1001 ),
|
|
|
|
( 2000,
|
|
|
|
"nevermind",
|
|
|
|
1001 ),
|
|
|
|
( 2003,
|
|
|
|
"lateralus",
|
|
|
|
1002 ),
|
|
|
|
( 2004,
|
|
|
|
"fear innoculum",
|
|
|
|
1002 );
|
|
|
|
|
|
|
|
-- These are for testing global limits.
|
|
|
|
|
|
|
|
CREATE TABLE hasura_test.LimitedArtist (
|
|
|
|
artist_self_id int64,
|
|
|
|
name string);
|
|
|
|
|
|
|
|
CREATE TABLE hasura_test.LimitedAlbum (
|
|
|
|
album_self_id int64,
|
|
|
|
artist_other_id int64,
|
|
|
|
title string);
|
|
|
|
|
|
|
|
INSERT INTO hasura_test.LimitedArtist
|
|
|
|
VALUES (1002,
|
|
|
|
"tool" ),
|
|
|
|
(1000,
|
|
|
|
"alice in chains" ),
|
|
|
|
(1001,
|
|
|
|
"nirvana" );
|
|
|
|
|
|
|
|
INSERT INTO hasura_test.LimitedAlbum
|
|
|
|
(album_self_id,
|
|
|
|
title,
|
|
|
|
artist_other_id)
|
|
|
|
VALUES ( 2002,
|
|
|
|
"dirt",
|
|
|
|
1000 ),
|
|
|
|
( 2005,
|
|
|
|
"facelift",
|
|
|
|
1000 ),
|
|
|
|
( 2001,
|
|
|
|
"in utero",
|
|
|
|
1001 ),
|
|
|
|
( 2000,
|
|
|
|
"nevermind",
|
|
|
|
1001 ),
|
|
|
|
( 2003,
|
|
|
|
"lateralus",
|
|
|
|
1002 ),
|
|
|
|
( 2004,
|
|
|
|
"fear innoculum",
|
|
|
|
1002 );
|
|
|
|
SELECT * from hasura_test.Album;
|
2021-12-15 18:18:56 +03:00
|
|
|
|
|
|
|
CREATE TABLE `hasura_test.article_citation` (
|
|
|
|
`article_id` INT64,
|
|
|
|
`cited_article_id` INT64,
|
|
|
|
`description` STRING,
|
|
|
|
);
|
|
|
|
INSERT INTO hasura_test.article_citation
|
|
|
|
(article_id, cited_article_id, description)
|
|
|
|
VALUES (1, 2, 'citing the 2nd'),
|
|
|
|
(1, 3, 'citing the third as well'),
|
|
|
|
(2, 3, 'the second also cites the third');
|
|
|
|
|
|
|
|
-- a copy for remote joins as we can't have the same table tracked in two sources
|
|
|
|
CREATE TABLE `hasura_test.article_citation2`
|
|
|
|
AS SELECT * FROM `hasura_test.article_citation`;
|