@malloydata/malloy 0.0.16-dev221216150223 → 0.0.16-dev221220164559

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.
@@ -2140,7 +2140,8 @@ class SQLStatement extends MalloyElement {
2140
2140
  sqlDefEntry.reference(sql.name, this.location);
2141
2141
  const lookup = sqlDefEntry.getEntry(sql.name);
2142
2142
  if (lookup.status == "error") {
2143
- this.select.log(`'Schema error: ${lookup.message}`);
2143
+ const msgLines = lookup.message.split(/\r?\n/);
2144
+ this.select.log("Invalid SQL, " + msgLines.join("\n "));
2144
2145
  return undefined;
2145
2146
  }
2146
2147
  if (lookup.status == "present") {
@@ -1280,6 +1280,22 @@ describe("error handling", () => {
1280
1280
  test("popping out of embedding when not embedded", () => {
1281
1281
  expect("}%").compileToFailWith("extraneous input '}%' expecting {<EOF>, EXPLORE, QUERY, SOURCE, SQL, IMPORT, ';'}");
1282
1282
  });
1283
+ test("bad sql in sql block", () => {
1284
+ const badModel = new BetaModel(`sql: { select: """)""" }`);
1285
+ expect(badModel).modelParsed();
1286
+ const needSchema = badModel.translate();
1287
+ expect(needSchema.compileSQL).toBeDefined();
1288
+ if (needSchema.compileSQL) {
1289
+ badModel.update({
1290
+ errors: {
1291
+ compileSQL: {
1292
+ [needSchema.compileSQL.name]: "ZZZZ",
1293
+ },
1294
+ },
1295
+ });
1296
+ }
1297
+ expect(badModel).compileToFailWith("Invalid SQL, ZZZZ");
1298
+ });
1283
1299
  });
1284
1300
  function getSelectOneStruct(sqlBlock) {
1285
1301
  const selectThis = sqlBlock.select[0];
@@ -215,7 +215,7 @@ declare class QueryQuery extends QueryField {
215
215
  static makeQuery(fieldDef: TurtleDef, parentStruct: QueryStruct, stageWriter?: StageWriter | undefined): QueryQuery;
216
216
  getFieldList(): QueryFieldDef[];
217
217
  expandField(f: QueryFieldDef): {
218
- as: string;
218
+ as: any;
219
219
  field: QuerySomething;
220
220
  };
221
221
  expandDependantField(resultStruct: FieldInstanceResult, fieldRef: FieldRef): void;
@@ -247,10 +247,7 @@ declare class QueryQuery extends QueryField {
247
247
  generateTurtleSQL(resultStruct: FieldInstanceResult, stageWriter: StageWriter, sqlFieldName: string, outputPipelinedSQL: OutputPipelinedSQL[]): string;
248
248
  generateTurtlePipelineSQL(fi: FieldInstanceResult, stageWriter: StageWriter, sourceSQLExpression: string): {
249
249
  structDef: StructDef;
250
- pipeOut: {
251
- lastStageName: string;
252
- outputStruct: StructDef;
253
- } | undefined;
250
+ pipeOut: any;
254
251
  };
255
252
  generateComplexSQL(stageWriter: StageWriter): string;
256
253
  generateSQL(stageWriter: StageWriter): string;
@@ -286,7 +283,7 @@ declare class QueryStruct extends QueryNode {
286
283
  getJoinableParent(): QueryStruct;
287
284
  addFieldToNameMap(as: string, n: QuerySomething): void;
288
285
  /** the the primary key or throw an error. */
289
- getPrimaryKeyField(fieldDef: FieldDef): QueryAtomicField;
286
+ getPrimaryKeyField(fieldDef: FieldDef): any;
290
287
  /**
291
288
  * called after all structure has been loaded. Examine this structure to see
292
289
  * if if it is based on a query and if it is, add the output fields (unless
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.16-dev221216150223",
3
+ "version": "0.0.16-dev221220164559",
4
4
  "license": "GPL-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",