@malloydata/malloy 0.0.420 → 0.0.422

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.
@@ -1300,11 +1300,16 @@ class PersistSource {
1300
1300
  getSQL(options) {
1301
1301
  const sd = this.persistableDef;
1302
1302
  const queryModel = this.model.queryModel;
1303
+ // Compile with finalize=false so this SQL is the bare source SELECT.
1304
+ // The build-time key (makeBuildId over this SQL) must equal the serve-time
1305
+ // manifest lookup key, which query_query.ts recomputes from the same
1306
+ // unfinalized SELECT; finalizing would diverge the two on dialects with a
1307
+ // final stage (Postgres) and mis-materialize the table.
1303
1308
  if (sd.type === 'sql_select') {
1304
- return (0, model_1.getCompiledSQL)(sd, options !== null && options !== void 0 ? options : {}, (query, opts) => queryModel.compileQuery(query, opts).sql);
1309
+ return (0, model_1.getCompiledSQL)(sd, options !== null && options !== void 0 ? options : {}, (query, opts) => queryModel.compileQuery(query, opts, false).sql);
1305
1310
  }
1306
1311
  else {
1307
- const compiled = queryModel.compileQuery(sd.query, options);
1312
+ const compiled = queryModel.compileQuery(sd.query, options, false);
1308
1313
  return compiled.sql;
1309
1314
  }
1310
1315
  }
@@ -20,6 +20,7 @@ export declare function humanify(value: unknown): string;
20
20
  export declare const TEST_DIALECT = "duckdb";
21
21
  export declare const aTableDef: TableSourceDef;
22
22
  export declare const bqTableDef: SourceDef;
23
+ export declare const pgTableDef: SourceDef;
23
24
  /**
24
25
  * A TestTranlator never actually talks to connection, instead uses
25
26
  * some mocked schema definitions.
@@ -5,7 +5,7 @@
5
5
  * SPDX-License-Identifier: MIT
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.BetaExpression = exports.TestTranslator = exports.TestChildTranslator = exports.mockSchema = exports.bqTableDef = exports.aTableDef = exports.TEST_DIALECT = void 0;
8
+ exports.BetaExpression = exports.TestTranslator = exports.TestChildTranslator = exports.mockSchema = exports.pgTableDef = exports.bqTableDef = exports.aTableDef = exports.TEST_DIALECT = void 0;
9
9
  exports.pretty = pretty;
10
10
  exports.humanify = humanify;
11
11
  exports.getExplore = getExplore;
@@ -171,6 +171,17 @@ exports.bqTableDef = {
171
171
  connection: '_bq_',
172
172
  fields: baseFields,
173
173
  };
174
+ // Postgres table definition — Postgres is the only dialect with
175
+ // `hasFinalStage = true`, so it is the one that exercises the persist-source
176
+ // finalize=false path (see PersistSource.getSQL).
177
+ exports.pgTableDef = {
178
+ type: 'table',
179
+ name: 'aTable',
180
+ dialect: 'postgres',
181
+ tablePath: 'aTable',
182
+ connection: '_pg_',
183
+ fields: baseFields,
184
+ };
174
185
  /**
175
186
  * A TestTranlator never actually talks to connection, instead uses
176
187
  * some mocked schema definitions.
@@ -178,6 +189,7 @@ exports.bqTableDef = {
178
189
  exports.mockSchema = [
179
190
  exports.aTableDef,
180
191
  exports.bqTableDef,
192
+ exports.pgTableDef,
181
193
  {
182
194
  type: 'table',
183
195
  name: 'carriers',
@@ -350,6 +362,7 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
350
362
  contents: {
351
363
  _db_: { type: 'connection', name: '_db_' },
352
364
  _bq_: { type: 'connection', name: '_bq_' },
365
+ _pg_: { type: 'connection', name: '_pg_' },
353
366
  a: { ...exports.aTableDef, primaryKey: 'astr', name: 'a' },
354
367
  b: { ...exports.aTableDef, primaryKey: 'astr', name: 'b' },
355
368
  bq_a: { ...exports.bqTableDef, primaryKey: 'astr', name: 'bq_a' },
@@ -405,6 +418,7 @@ class TestTranslator extends parse_malloy_1.MalloyTranslator {
405
418
  }
406
419
  this.connectionDialectZone.define('_db_', exports.TEST_DIALECT);
407
420
  this.connectionDialectZone.define('_bq_', 'standardsql');
421
+ this.connectionDialectZone.define('_pg_', 'postgres');
408
422
  for (const flag of (_e = options.compilerFlags) !== null && _e !== void 0 ? _e : []) {
409
423
  this.compilerFlagSrc.push(`##! ${flag}\n`);
410
424
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const MALLOY_VERSION = "0.0.420";
1
+ export declare const MALLOY_VERSION = "0.0.422";
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MALLOY_VERSION = void 0;
4
4
  // generated with 'generate-version-file' script; do not edit manually
5
- exports.MALLOY_VERSION = '0.0.420';
5
+ exports.MALLOY_VERSION = '0.0.422';
6
6
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy",
3
- "version": "0.0.420",
3
+ "version": "0.0.422",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./dist/index.js",
@@ -51,9 +51,9 @@
51
51
  "generate-version-file": "VERSION=$(npm pkg get version --workspaces=false | tr -d \\\")\necho \"// generated with 'generate-version-file' script; do not edit manually\\nexport const MALLOY_VERSION = '$VERSION';\" > src/version.ts"
52
52
  },
53
53
  "dependencies": {
54
- "@malloydata/malloy-filter": "0.0.420",
55
- "@malloydata/malloy-interfaces": "0.0.420",
56
- "@malloydata/malloy-tag": "0.0.420",
54
+ "@malloydata/malloy-filter": "0.0.422",
55
+ "@malloydata/malloy-interfaces": "0.0.422",
56
+ "@malloydata/malloy-tag": "0.0.422",
57
57
  "@noble/hashes": "^1.8.0",
58
58
  "antlr4ts": "^0.5.0-alpha.4",
59
59
  "assert": "^2.0.0",