@malloydata/malloy 0.0.86-dev230922233440 → 0.0.86-dev230923002041

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.
@@ -598,6 +598,9 @@ class MalloyToAST extends AbstractParseTreeVisitor_1.AbstractParseTreeVisitor {
598
598
  const queryDefs = this.visitSubQueryDefList(pcx.subQueryDefList());
599
599
  const blockNotes = this.getNotes(pcx.tags());
600
600
  queryDefs.extendNote({ blockNotes });
601
+ if (this.m4WarningsEnabled() && pcx.QUERY()) {
602
+ this.contextError(pcx, 'Use view: inside of a source instead of query:', 'warn');
603
+ }
601
604
  return queryDefs;
602
605
  }
603
606
  visitDefExplorePrimaryKey(pcx) {
@@ -797,7 +797,7 @@ describe('extend and refine', () => {
797
797
  test('implicit refine in nest', () => {
798
798
  expect(`##! m4warnings
799
799
  source: c is a extend {
800
- query: x is { select: * }
800
+ view: x is { select: * }
801
801
  }
802
802
 
803
803
  run: c -> {
@@ -807,8 +807,8 @@ describe('extend and refine', () => {
807
807
  test('implicit refine in turtle works', () => {
808
808
  expect(`##! m4warnings
809
809
  source: c is a extend {
810
- query: x is { select: * }
811
- query: y is x { limit: 1 }
810
+ view: x is { select: * }
811
+ view: y is x { limit: 1 }
812
812
  }`).toTranslateWithWarnings('Implicit query refinement is deprecated, use the `refine` operator.');
813
813
  });
814
814
  test('implicit query refinement', () => {
@@ -112,7 +112,7 @@ describe('source:', () => {
112
112
  test('where clause can use the join namespace in source refined query', () => {
113
113
  expect(`
114
114
  source: flights is table('malloytest.flights') + {
115
- query: boo is {
115
+ view: boo is {
116
116
  join_one: carriers is table('malloytest.carriers') on carrier = carriers.code
117
117
  where: carriers.code = 'WN' | 'AA'
118
118
  group_by: carriers.nickname
@@ -198,15 +198,17 @@ describe('source:', () => {
198
198
  expect('source: c is a { except: astr, af }').toTranslate();
199
199
  });
200
200
  test('turtle in a source can be called view', () => {
201
- expect('source: c is a {view: q is { group_by: astr } }').toTranslate();
201
+ expect('source: c is a extend {view: q is { group_by: astr } }').toTranslate();
202
202
  });
203
- test('turtle in source can be called query', () => {
204
- expect('source: c is a {query: q is { group_by: astr } }').toTranslate();
203
+ test('turtle in source can be called query with m4 warning', () => {
204
+ expect(`##! m4warnings
205
+ source: c is a extend {query: q is { group_by: astr } }
206
+ `).toTranslateWithWarnings('Use view: inside of a source instead of query:');
205
207
  });
206
208
  test('refined explore-query', () => {
207
209
  expect(`
208
210
  source: abNew is ab {
209
- query: for1 is aturtle {? ai = 1 }
211
+ view: for1 is aturtle {? ai = 1 }
210
212
  }
211
213
  `).toTranslate();
212
214
  });
@@ -214,14 +216,14 @@ describe('source:', () => {
214
216
  expect(`
215
217
  ##! m4warnings
216
218
  source: abNew is ab extend {
217
- query: for1 is aturtle refine {? ai = 1 }
219
+ view: for1 is aturtle refine {? ai = 1 }
218
220
  }
219
221
  `).toTranslateWithWarnings('Filter shortcut `{? condition }` is deprecated; use `{ where: condition } instead');
220
222
  });
221
223
  test('chained explore-query', () => {
222
224
  expect(`
223
225
  source: c is a {
224
- query: chain is {
226
+ view: chain is {
225
227
  group_by: astr
226
228
  } -> {
227
229
  top: 10; order_by: astr
@@ -233,7 +235,7 @@ describe('source:', () => {
233
235
  test('multiple explore-query', () => {
234
236
  expect(`
235
237
  source: abNew is ab {
236
- query:
238
+ view:
237
239
  q1 is { group_by: astr },
238
240
  q2 is { group_by: ai }
239
241
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.86-dev230922233440",
3
+ "version": "0.0.86-dev230923002041",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",