@malloydata/malloy-tests 0.0.95-dev231019211822 → 0.0.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +213 -1
  2. package/dist/api.spec.d.ts +1 -1
  3. package/dist/api.spec.js +6 -13
  4. package/dist/api.spec.js.map +1 -1
  5. package/dist/databases/all/db_index.spec.js +21 -41
  6. package/dist/databases/all/db_index.spec.js.map +1 -1
  7. package/dist/databases/all/expr.spec.js +262 -339
  8. package/dist/databases/all/expr.spec.js.map +1 -1
  9. package/dist/databases/all/functions.spec.js +37 -35
  10. package/dist/databases/all/functions.spec.js.map +1 -1
  11. package/dist/databases/all/join.spec.js +125 -169
  12. package/dist/databases/all/join.spec.js.map +1 -1
  13. package/dist/databases/all/nomodel.spec.js +335 -594
  14. package/dist/databases/all/nomodel.spec.js.map +1 -1
  15. package/dist/databases/all/orderby.spec.js +82 -128
  16. package/dist/databases/all/orderby.spec.js.map +1 -1
  17. package/dist/databases/all/sql_expressions.spec.js +27 -43
  18. package/dist/databases/all/sql_expressions.spec.js.map +1 -1
  19. package/dist/databases/all/time.spec.js +63 -103
  20. package/dist/databases/all/time.spec.js.map +1 -1
  21. package/dist/databases/bigquery/double_truncation.spec.js +1 -1
  22. package/dist/databases/bigquery/handexpr.spec.js +12 -12
  23. package/dist/databases/bigquery/injestion_time_partitioning.spec.js +22 -22
  24. package/dist/databases/bigquery/joined_filters.spec.js +3 -3
  25. package/dist/databases/bigquery/json.spec.d.ts +1 -1
  26. package/dist/databases/bigquery/json.spec.js +25 -45
  27. package/dist/databases/bigquery/json.spec.js.map +1 -1
  28. package/dist/databases/bigquery/malloy_query.spec.d.ts +1 -1
  29. package/dist/databases/bigquery/malloy_query.spec.js +47 -48
  30. package/dist/databases/bigquery/malloy_query.spec.js.map +1 -1
  31. package/dist/databases/bigquery/time.spec.js +9 -13
  32. package/dist/databases/bigquery/time.spec.js.map +1 -1
  33. package/dist/databases/bigquery/wildcard_table_names.spec.js +19 -19
  34. package/dist/databases/bigquery-duckdb/nested_source_table.spec.js +53 -87
  35. package/dist/databases/bigquery-duckdb/nested_source_table.spec.js.map +1 -1
  36. package/dist/databases/bigquery-postgres/multi_connection.spec.js +5 -20
  37. package/dist/databases/bigquery-postgres/multi_connection.spec.js.map +1 -1
  38. package/dist/databases/bigquery-postgres/streaming.spec.js +6 -6
  39. package/dist/databases/bigquery-postgres/streaming.spec.js.map +1 -1
  40. package/dist/databases/duckdb/duckdb.spec.js +24 -33
  41. package/dist/databases/duckdb/duckdb.spec.js.map +1 -1
  42. package/dist/databases/postgres/postgres.spec.js +46 -67
  43. package/dist/databases/postgres/postgres.spec.js.map +1 -1
  44. package/dist/jestMatcher.spec.d.ts +1 -0
  45. package/dist/jestMatcher.spec.js +81 -0
  46. package/dist/jestMatcher.spec.js.map +1 -0
  47. package/dist/render/render.spec.js +10 -12
  48. package/dist/render/render.spec.js.map +1 -1
  49. package/dist/tags.spec.js +22 -2
  50. package/dist/tags.spec.js.map +1 -1
  51. package/dist/util/db-jest-matchers.d.ts +17 -6
  52. package/dist/util/db-jest-matchers.js +81 -20
  53. package/dist/util/db-jest-matchers.js.map +1 -1
  54. package/dist/util/index.d.ts +1 -2
  55. package/dist/util/index.js +11 -13
  56. package/dist/util/index.js.map +1 -1
  57. package/package.json +6 -6
  58. package/src/api.spec.ts +7 -16
  59. package/src/databases/all/db_index.spec.ts +22 -48
  60. package/src/databases/all/expr.spec.ts +273 -431
  61. package/src/databases/all/functions.spec.ts +37 -35
  62. package/src/databases/all/join.spec.ts +130 -196
  63. package/src/databases/all/nomodel.spec.ts +333 -689
  64. package/src/databases/all/orderby.spec.ts +87 -161
  65. package/src/databases/all/sql_expressions.spec.ts +29 -49
  66. package/src/databases/all/time.spec.ts +73 -130
  67. package/src/databases/bigquery/double_truncation.spec.ts +1 -1
  68. package/src/databases/bigquery/handexpr.spec.ts +12 -12
  69. package/src/databases/bigquery/injestion_time_partitioning.spec.ts +22 -22
  70. package/src/databases/bigquery/joined_filters.spec.ts +3 -3
  71. package/src/databases/bigquery/json.spec.ts +25 -49
  72. package/src/databases/bigquery/malloy_query.spec.ts +47 -54
  73. package/src/databases/bigquery/time.spec.ts +13 -17
  74. package/src/databases/bigquery/wildcard_table_names.spec.ts +19 -19
  75. package/src/databases/bigquery-duckdb/nested_source_table.spec.ts +56 -98
  76. package/src/databases/bigquery-postgres/multi_connection.spec.ts +5 -23
  77. package/src/databases/bigquery-postgres/streaming.spec.ts +12 -6
  78. package/src/databases/duckdb/duckdb.spec.ts +31 -43
  79. package/src/databases/postgres/postgres.spec.ts +54 -84
  80. package/src/jestMatcher.spec.ts +88 -0
  81. package/src/render/render.spec.ts +10 -12
  82. package/src/tags.spec.ts +22 -2
  83. package/src/util/db-jest-matchers.ts +106 -32
  84. package/src/util/index.ts +16 -14
@@ -34,7 +34,7 @@ const timeSQL =
34
34
 
35
35
  // MTOY todo look at this list for timezone problems, I know there are some
36
36
  describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
37
- const sqlEq = mkSqlEqWith(runtime, {sql: timeSQL});
37
+ const sqlEq = mkSqlEqWith(runtime, dbName, {sql: timeSQL});
38
38
 
39
39
  describe('interval measurement', () => {
40
40
  test('forwards is positive', async () => {
@@ -458,16 +458,13 @@ describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
458
458
  });
459
459
 
460
460
  test('dependant join dialect fragments', async () => {
461
- await expect(runtime).queryMatches(
462
- `
463
- sql: timeData is { connection: "${dbName}" select: """${timeSQL}""" }
464
- query: from_sql(timeData) -> {
465
- join_one: joined is from_sql(timeData) on t_date = joined.t_date
466
- group_by: t_month is joined.t_timestamp.month
467
- }
468
- `,
469
- {t_month: new Date('2021-02-01')}
470
- );
461
+ await expect(`
462
+ source: timeData is ${dbName}.sql("""${timeSQL}""")
463
+ run: timeData -> {
464
+ extend: {join_one: joined is timeData on t_date = joined.t_date}
465
+ group_by: t_month is joined.t_timestamp.month
466
+ }
467
+ `).malloyResultMatches(runtime, {t_month: new Date('2021-02-01')});
471
468
  });
472
469
 
473
470
  describe('timezone set correctly', () => {
@@ -476,41 +473,35 @@ describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
476
473
  (
477
474
  await runQuery(
478
475
  runtime,
479
- `sql: timeData is { connection: "${dbName}" select: """SELECT 1"""}
480
- source: timezone is from_sql(timeData) + {
481
- timezone: 'America/Los_Angeles'
482
- dimension: la_time is @2021-02-24 03:05:06
483
- }
484
- query: timezone -> {
485
- group_by: la_time
486
- }
487
- `
476
+ `run: ${dbName}.sql("SELECT 1") extend {
477
+ timezone: 'America/Los_Angeles'
478
+ dimension: la_time is @2021-02-24 03:05:06
479
+ } -> {
480
+ group_by: la_time
481
+ }`
488
482
  )
489
483
  ).resultExplore.queryTimezone
490
484
  ).toBe('America/Los_Angeles');
491
485
  });
492
486
 
487
+ // TODO don't need to run this on all connections, so testIf not needed
493
488
  testIf(runtime.supportsNesting)(
494
- 'timezone set in query inside source',
489
+ 'timezone set in view inside source',
495
490
  async () => {
496
491
  expect(
497
492
  (
498
493
  await runQuery(
499
494
  runtime,
500
- `sql: timeData is { connection: "${dbName}" select: """SELECT 1"""}
501
- source: timezone is from_sql(timeData) + {
502
- dimension: default_time is @2021-02-24 03:05:06
503
- query: la_query is {
504
- timezone: 'America/Los_Angeles'
505
- select: la_time is @2021-02-24 03:05:06
506
- }
507
- }
508
-
509
- query: timezone -> {
510
- group_by: default_time
511
- nest: la_query
512
- }
513
- `
495
+ `run: ${dbName}.sql("SELECT 1") extend {
496
+ dimension: default_time is @2021-02-24 03:05:06
497
+ view: la_query is {
498
+ timezone: 'America/Los_Angeles'
499
+ select: la_time is @2021-02-24 03:05:06
500
+ }
501
+ } -> {
502
+ group_by: default_time
503
+ nest: la_query
504
+ }`
514
505
  )
515
506
  ).resultExplore.structDef
516
507
  ).toMatchObject({
@@ -522,6 +513,7 @@ describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
522
513
  }
523
514
  );
524
515
 
516
+ // TODO don't need to run this on all connections, so testIf not needed
525
517
  testIf(runtime.supportsNesting)(
526
518
  'timezone set in query using source',
527
519
  async () => {
@@ -529,20 +521,16 @@ describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
529
521
  (
530
522
  await runQuery(
531
523
  runtime,
532
- `sql: timeData is { connection: "${dbName}" select: """SELECT 1"""}
533
- source: timezone is from_sql(timeData) + {
534
- dimension: default_time is @2021-02-24 03:05:06
535
- query: undef_query is {
536
- select: undef_time is @2021-02-24 03:05:06
537
- }
538
- }
539
-
540
- query: timezone -> {
541
- timezone: 'America/Los_Angeles'
542
- group_by: default_time
543
- nest: undef_query
544
- }
545
- `
524
+ `run: ${dbName}.sql("SELECT 1") extend {
525
+ dimension: default_time is @2021-02-24 03:05:06
526
+ view: undef_query is {
527
+ select: undef_time is @2021-02-24 03:05:06
528
+ }
529
+ } -> {
530
+ timezone: 'America/Los_Angeles'
531
+ group_by: default_time
532
+ nest: undef_query
533
+ }`
546
534
  )
547
535
  ).resultExplore.queryTimezone
548
536
  ).toBe('America/Los_Angeles');
@@ -550,32 +538,25 @@ describe.each(runtimes.runtimeList)('%s date and time', (dbName, runtime) => {
550
538
  );
551
539
 
552
540
  testIf(runtime.supportsNesting)('multiple timezones', async () => {
553
- expect(
554
- (
555
- await runQuery(
556
- runtime,
557
- `sql: timeData is { connection: "${dbName}" select: """SELECT 1"""}
558
- source: timezone is from_sql(timeData) + {
541
+ const theQuery = await runQuery(
542
+ runtime,
543
+ `run: ${dbName}.sql('SELECT 1') extend {
559
544
  timezone: 'America/New_York'
560
545
  dimension: ny_time is @2021-02-24 03:05:06
561
- query: la_query is {
546
+ view: la_query is {
562
547
  timezone: 'America/Los_Angeles'
563
548
  select: la_time is @2021-02-24 03:05:06
564
549
  }
565
- query: mex_query is {
550
+ view: mex_query is {
566
551
  timezone: 'America/Mexico_City'
567
552
  select: mex_time is @2021-02-24 03:05:06
568
553
  }
569
- }
570
-
571
- query: timezone -> {
572
- group_by: ny_time
573
- nest: la_query, mex_query
574
- }
575
- `
576
- )
577
- ).resultExplore.structDef
578
- ).toMatchObject({
554
+ } -> {
555
+ group_by: ny_time
556
+ nest: la_query, mex_query
557
+ }`
558
+ );
559
+ expect(theQuery.resultExplore.structDef).toMatchObject({
579
560
  queryTimezone: 'America/New_York',
580
561
  fields: [
581
562
  {},
@@ -630,8 +611,7 @@ describe.each(runtimes.runtimeList)('%s: tz literals', (dbName, runtime) => {
630
611
  // really tests nothing, but I feel calmer with this here.
631
612
  const query = runtime.loadQuery(
632
613
  `
633
- sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
634
- query: from_sql(tzTest) -> {
614
+ run: ${dbName}.sql("SELECT 1") -> {
635
615
  group_by: literalTime is @2020-02-20 00:00:00
636
616
  }
637
617
  `
@@ -645,8 +625,7 @@ describe.each(runtimes.runtimeList)('%s: tz literals', (dbName, runtime) => {
645
625
  test('literal with zone name', async () => {
646
626
  const query = runtime.loadQuery(
647
627
  `
648
- sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
649
- query: from_sql(tzTest) -> {
628
+ run: ${dbName}.sql("SELECT 1") -> {
650
629
  group_by: literalTime is @2020-02-20 00:00:00[America/Mexico_City]
651
630
  }
652
631
  `
@@ -662,12 +641,11 @@ describe.each(runtimes.runtimeList)('%s: query tz', (dbName, runtime) => {
662
641
  test('literal timestamps', async () => {
663
642
  const query = runtime.loadQuery(
664
643
  `
665
- sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
666
- query: from_sql(tzTest) -> {
644
+ run: ${dbName}.sql("SELECT 1") -> {
667
645
  timezone: '${zone}'
668
646
  group_by: literalTime is @2020-02-20 00:00:00
669
647
  }
670
- `
648
+ `
671
649
  );
672
650
  const result = await query.run();
673
651
  const literal = result.data.path(0, 'literalTime').value as Date;
@@ -676,84 +654,49 @@ describe.each(runtimes.runtimeList)('%s: query tz', (dbName, runtime) => {
676
654
  });
677
655
 
678
656
  test('extract', async () => {
679
- await expect(runtime).queryMatches(
680
- `sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
681
- query: from_sql(tzTest) -> {
657
+ await expect(
658
+ `run: ${dbName}.sql("SELECT 1") -> {
682
659
  timezone: '${zone}'
683
- declare: utc_midnight is @2020-02-20 00:00:00[UTC]
660
+ extend: { dimension: utc_midnight is @2020-02-20 00:00:00[UTC] }
684
661
  select:
685
662
  mex_midnight is hour(utc_midnight)
686
663
  mex_day is day(utc_midnight)
687
- }`,
688
- {mex_midnight: 18, mex_day: 19}
689
- );
664
+ }`
665
+ ).malloyResultMatches(runtime, {mex_midnight: 18, mex_day: 19});
690
666
  });
691
667
 
692
668
  test('truncate day', async () => {
693
669
  // At midnight in london it the 19th in Mexico, so that truncates to
694
670
  // midnight on the 19th
695
671
  const mex_19 = LuxonDateTime.fromISO('2020-02-19T00:00:00', {zone});
696
- await expect(runtime).queryMatches(
697
- `sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
698
- query: from_sql(tzTest) -> {
672
+ await expect(
673
+ `run: ${dbName}.sql("SELECT 1 as x") -> {
699
674
  timezone: '${zone}'
700
- declare: utc_midnight is @2020-02-20 00:00:00[UTC]
701
- select:
702
- mex_day is utc_midnight.day
703
- }`,
704
- {mex_day: mex_19.toJSDate()}
705
- );
675
+ extend: { dimension: utc_midnight is @2020-02-20 00:00:00[UTC] }
676
+ select: mex_day is utc_midnight.day
677
+ }`
678
+ ).malloyResultMatches(runtime, {mex_day: mex_19.toJSDate()});
706
679
  });
707
680
 
708
681
  test('cast timestamp to date', async () => {
709
- // At midnight in london it the 19th in Mexico, so when we cast that
682
+ // At midnight in london it is the 19th in Mexico, so when we cast that
710
683
  // to a date, it should be the 19th.
711
- await expect(runtime).queryMatches(
712
- `sql: tzTest is { connection: "${dbName}" select: """SELECT 1 as one""" }
713
- query: from_sql(tzTest) -> {
684
+ await expect(
685
+ `run: ${dbName}.sql("SELECT 1 as x") -> {
714
686
  timezone: '${zone}'
715
- declare: utc_midnight is @2020-02-20 00:00:00[UTC]
687
+ extend: { dimension: utc_midnight is @2020-02-20 00:00:00[UTC] }
716
688
  select: mex_day is day(utc_midnight::date)
717
- }`,
718
- {mex_day: 19}
719
- );
689
+ }`
690
+ ).malloyResultMatches(runtime, {mex_day: 19});
720
691
  });
721
692
 
722
693
  test('cast date to timestamp', async () => {
723
- await expect(runtime).queryMatches(
724
- `sql: tzTest is { connection: "${dbName}" select: """
725
- SELECT DATE '2020-02-20' AS mex_20
726
- """ }
727
- query: from_sql(tzTest) -> {
694
+ await expect(
695
+ `run: ${dbName}.sql(" SELECT DATE '2020-02-20' AS mex_20") -> {
728
696
  timezone: '${zone}'
729
697
  select: mex_ts is mex_20::timestamp
730
- }`,
731
- {mex_ts: zone_2020.toJSDate()}
732
- );
733
- });
734
-
735
- test('can use unsupported types', async () => {
736
- if (dbName === 'bigquery') {
737
- await expect(runtime).queryMatches(
738
- `sql: timeData is { connection: "${dbName}" select: """
739
- SELECT DATETIME '2020-02-20 00:00:00' as t_datetime
740
- """}
741
- query: from_sql(timeData) -> {
742
- select: mex_220 is t_datetime::timestamp
743
- }`,
744
- {mex_220: utc_2020.toJSDate()}
745
- );
746
- } else if (dbName === 'duckdb' || dbName === 'postgres') {
747
- await expect(runtime).queryMatches(
748
- `sql: timeData is { connection: "duckdb" select: """
749
- SELECT TIMESTAMPTZ '2020-02-20 00:00:00 ${zone}' as t_tstz
750
- """}
751
- query: from_sql(timeData) -> {
752
- select: mex_220 is t_tstz::timestamp
753
- }`,
754
- {mex_220: zone_2020.toJSDate()}
755
- );
756
- }
698
+ }`
699
+ ).malloyResultMatches(runtime, {mex_ts: zone_2020.toJSDate()});
757
700
  });
758
701
  });
759
702
 
@@ -37,7 +37,7 @@ describe('BigQuery double truncation', () => {
37
37
  expect(runtime).toBeDefined();
38
38
  if (runtime) {
39
39
  const src = `
40
- query: table('malloy-data.faa.flights') -> {
40
+ run: bigquery.table('malloy-data.faa.flights') -> {
41
41
  group_by: takeoff_week is dep_time.week
42
42
  }
43
43
  `;
@@ -368,7 +368,7 @@ describe('BigQuery hand-built expression test', () => {
368
368
  const result = await handModel
369
369
  .loadQuery(
370
370
  `
371
- query: aircraft->hand_turtle
371
+ run: aircraft->hand_turtle
372
372
  `
373
373
  )
374
374
  .run();
@@ -379,7 +379,7 @@ describe('BigQuery hand-built expression test', () => {
379
379
  const result = await handModel
380
380
  .loadQuery(
381
381
  `
382
- query: aircraft->{
382
+ run: aircraft->{
383
383
  group_by: state
384
384
  aggregate: aircraft_count
385
385
  limit: 10
@@ -394,7 +394,7 @@ describe('BigQuery hand-built expression test', () => {
394
394
  const result = await handModel
395
395
  .loadQuery(
396
396
  `
397
- query: aircraft->{
397
+ run: aircraft->{
398
398
  group_by: state
399
399
  aggregate: aircraft_count
400
400
  order_by: 2
@@ -581,14 +581,14 @@ describe('BigQuery hand-built expression test', () => {
581
581
  const result = await handModel
582
582
  .loadQuery(
583
583
  `
584
- query: aircraft->{
584
+ run: aircraft->{
585
585
  aggregate:
586
586
  aircraft_models.total_seats,
587
587
  total_seats2 is sum(aircraft_models.seats),
588
588
  total_seats3 is aircraft_models.sum(aircraft_models.seats),
589
589
  aircraft_models.boeing_seats,
590
- boeing_seats2 is aircraft_models.sum(aircraft_models.seats) {? aircraft_models.manufacturer ? 'BOEING'},
591
- boeing_seats3 is aircraft_models.boeing_seats {? aircraft_models.manufacturer ? ~'B%'}
590
+ boeing_seats2 is aircraft_models.sum(aircraft_models.seats) { where: aircraft_models.manufacturer ? 'BOEING'},
591
+ boeing_seats3 is aircraft_models.boeing_seats { where: aircraft_models.manufacturer ? ~'B%'}
592
592
  }
593
593
  `
594
594
  )
@@ -606,7 +606,7 @@ describe('BigQuery hand-built expression test', () => {
606
606
  const result = await handModel
607
607
  .loadQuery(
608
608
  `
609
- query: aircraft->{
609
+ run: aircraft->{
610
610
  aggregate: total_seats3 is aircraft_models.sum(aircraft_models.seats)
611
611
  }
612
612
  `
@@ -622,7 +622,7 @@ describe('BigQuery hand-built expression test', () => {
622
622
  const result = await handModel
623
623
  .loadQuery(
624
624
  `
625
- query: aircraft->{
625
+ run: aircraft->{
626
626
  aggregate:
627
627
  aircraft_models.total_seats,
628
628
  aircraft_models.boeing_seats
@@ -638,8 +638,8 @@ describe('BigQuery hand-built expression test', () => {
638
638
  const result = await handModel
639
639
  .loadQuery(
640
640
  `
641
- query: aircraft->{
642
- aggregate: boeing_seats is aircraft_models.total_seats {? aircraft_models.manufacturer ?'BOEING'}
641
+ run: aircraft->{
642
+ aggregate: boeing_seats is aircraft_models.total_seats { where: aircraft_models.manufacturer ?'BOEING'}
643
643
  }
644
644
  `
645
645
  )
@@ -652,8 +652,8 @@ describe('BigQuery hand-built expression test', () => {
652
652
  const result = await handModel
653
653
  .loadQuery(
654
654
  `
655
- query: aircraft->{
656
- aggregate: boeing_aircraft is count() {?aircraft_models.manufacturer ?'BOEING'}
655
+ run: aircraft->{
656
+ aggregate: boeing_aircraft is count() { where:aircraft_models.manufacturer ?'BOEING'}
657
657
  }
658
658
  `
659
659
  )
@@ -39,13 +39,13 @@ describe('Wildcard BigQuery Tables', () => {
39
39
  const result = await runtime
40
40
  .loadQuery(
41
41
  `
42
- source: aircraft is table('malloy-data.malloytest.itp_hourly_aircraft') {
42
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_hourly_aircraft') extend {
43
43
  primary_key: id
44
44
  measure: aircraft_count is count()
45
45
  where: _PARTITIONTIME = @2023-03-06 17:00:00 to @2023-03-06 19:00:00
46
46
  }
47
47
 
48
- query: aircraft -> {
48
+ run: aircraft -> {
49
49
  aggregate: aircraft_count
50
50
  }
51
51
  `
@@ -62,13 +62,13 @@ describe('Wildcard BigQuery Tables', () => {
62
62
  const result = await runtime
63
63
  .loadQuery(
64
64
  `
65
- source: aircraft is table('malloy-data.malloytest.itp_daily_aircraft') {
65
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_daily_aircraft') extend {
66
66
  primary_key: id
67
67
  measure: aircraft_count is count()
68
68
  where: _PARTITIONTIME = @2023-03-06 00:00:00
69
69
  }
70
70
 
71
- query: aircraft -> {
71
+ run: aircraft -> {
72
72
  aggregate: aircraft_count
73
73
  }
74
74
  `
@@ -79,13 +79,13 @@ describe('Wildcard BigQuery Tables', () => {
79
79
  const empty_result = await runtime
80
80
  .loadQuery(
81
81
  `
82
- source: aircraft is table('malloy-data.malloytest.itp_daily_aircraft') {
82
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_daily_aircraft') extend {
83
83
  primary_key: id
84
84
  measure: aircraft_count is count()
85
85
  where: _PARTITIONTIME = @2023-03-06 00:00:01
86
86
  }
87
87
 
88
- query: aircraft -> {
88
+ run: aircraft -> {
89
89
  aggregate: aircraft_count
90
90
  }
91
91
  `
@@ -102,13 +102,13 @@ describe('Wildcard BigQuery Tables', () => {
102
102
  const result = await runtime
103
103
  .loadQuery(
104
104
  `
105
- source: aircraft is table('malloy-data.malloytest.itp_monthly_aircraft') {
105
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_monthly_aircraft') extend {
106
106
  primary_key: id
107
107
  measure: aircraft_count is count()
108
108
  where: _PARTITIONTIME = @2023-03-01 00:00:00
109
109
  }
110
110
 
111
- query: aircraft -> {
111
+ run: aircraft -> {
112
112
  aggregate: aircraft_count
113
113
  }
114
114
  `
@@ -119,13 +119,13 @@ describe('Wildcard BigQuery Tables', () => {
119
119
  const empty_result = await runtime
120
120
  .loadQuery(
121
121
  `
122
- source: aircraft is table('malloy-data.malloytest.itp_monthly_aircraft') {
122
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_monthly_aircraft') extend {
123
123
  primary_key: id
124
124
  measure: aircraft_count is count()
125
125
  where: _PARTITIONTIME = @2023-03-01 00:00:01
126
126
  }
127
127
 
128
- query: aircraft -> {
128
+ run: aircraft -> {
129
129
  aggregate: aircraft_count
130
130
  }
131
131
  `
@@ -142,15 +142,15 @@ describe('Wildcard BigQuery Tables', () => {
142
142
  const result = await runtime
143
143
  .loadQuery(
144
144
  `
145
- source: aircraft is table('malloy-data.malloytest.itp_hourly_aircraft') {
145
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_hourly_aircraft') extend {
146
146
  primary_key: id
147
147
  measure: aircraft_count is count()
148
148
  where: _PARTITIONTIME = @2023-03-06 17:00:00 to @2023-03-06 19:00:00
149
149
  }
150
- source: state_facts is table('malloy-data.malloytest.state_facts') {
150
+ source: state_facts is bigquery.table('malloy-data.malloytest.state_facts') extend {
151
151
  join_many: aircraft on state = aircraft.state
152
152
  }
153
- query: state_facts -> {
153
+ run: state_facts -> {
154
154
  group_by: aircraft.state
155
155
  aggregate: aircraft_count is aircraft.count()
156
156
  order_by: 1
@@ -179,15 +179,15 @@ describe('Wildcard BigQuery Tables', () => {
179
179
  const result = await runtime
180
180
  .loadQuery(
181
181
  `
182
- source: aircraft is table('malloy-data.malloytest.itp_hourly_aircraft') {
182
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_hourly_aircraft') extend {
183
183
  primary_key: id
184
184
  measure: aircraft_count is count()
185
185
  where: _PARTITIONTIME = @2023-03-06 17:00:00 to @2023-03-06 19:00:00
186
186
  }
187
- source: state_facts is table('malloy-data.malloytest.state_facts') {
187
+ source: state_facts is bigquery.table('malloy-data.malloytest.state_facts') extend {
188
188
  join_many: aircraft on state = aircraft.state
189
189
  }
190
- query: state_facts -> {
190
+ run: state_facts -> {
191
191
  group_by: aircraft.state
192
192
  aggregate: aircraft_count is aircraft.count()
193
193
  where: aircraft._PARTITIONTIME = @2023-03-06 18:00:00
@@ -212,12 +212,12 @@ describe('Wildcard BigQuery Tables', () => {
212
212
  const result = await runtime
213
213
  .loadQuery(
214
214
  `
215
- source: aircraft is table('malloy-data.malloytest.itp_daily_aircraft') {
215
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_daily_aircraft') extend {
216
216
  primary_key: id
217
217
  measure: aircraft_count is count()
218
218
  where: _PARTITIONDATE = @2023-03-06
219
219
  }
220
- query: aircraft -> {
220
+ run: aircraft -> {
221
221
  aggregate: aircraft_count
222
222
  }
223
223
  `
@@ -235,12 +235,12 @@ describe('Wildcard BigQuery Tables', () => {
235
235
  runtime
236
236
  .loadQuery(
237
237
  `
238
- source: aircraft is table('malloy-data.malloytest.itp_hourly_aircraft') {
238
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_hourly_aircraft') extend {
239
239
  primary_key: id
240
240
  measure: aircraft_count is count()
241
241
  where: _PARTITIONDATE = @2023-03-06
242
242
  }
243
- query: aircraft -> {
243
+ run: aircraft -> {
244
244
  aggregate: aircraft_count
245
245
  }
246
246
  `
@@ -251,12 +251,12 @@ describe('Wildcard BigQuery Tables', () => {
251
251
  runtime
252
252
  .loadQuery(
253
253
  `
254
- source: aircraft is table('malloy-data.malloytest.itp_monthly_aircraft') {
254
+ source: aircraft is bigquery.table('malloy-data.malloytest.itp_monthly_aircraft') extend {
255
255
  primary_key: id
256
256
  measure: aircraft_count is count()
257
257
  where: _PARTITIONDATE = @2023-03-06
258
258
  }
259
- query: aircraft -> {
259
+ run: aircraft -> {
260
260
  aggregate: aircraft_count
261
261
  }
262
262
  `
@@ -26,18 +26,18 @@ import {describeIfDatabaseAvailable} from '../../util';
26
26
 
27
27
  function sourceCodeWithFilter(filter: string) {
28
28
  return `
29
- source: aircraft_models is table('malloy-data.faa.aircraft_models') {
29
+ source: aircraft_models is bigquery.table('malloy-data.faa.aircraft_models') extend {
30
30
  primary_key: aircraft_model_code
31
31
  where: ${filter}
32
32
  }
33
33
 
34
- source: aircraft is table('malloy-data.faa.aircraft') {
34
+ source: aircraft is bigquery.table('malloy-data.faa.aircraft') extend {
35
35
  primary_key: tail_num
36
36
  measure: aircraft_count is count()
37
37
  join_one: aircraft_models with aircraft_model_code
38
38
  }
39
39
 
40
- query: aircraft -> {
40
+ run: aircraft -> {
41
41
  group_by: aircraft_models.aircraft_model_code
42
42
  }
43
43
  `;