@malloy-publisher/server 0.0.178 → 0.0.180

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.
@@ -12,7 +12,7 @@
12
12
  href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap"
13
13
  />
14
14
  <title>Malloy Publisher</title>
15
- <script type="module" crossorigin src="/assets/index-BJUsHnGO.js"></script>
15
+ <script type="module" crossorigin src="/assets/index-C2IkGoJ8.js"></script>
16
16
  <link rel="stylesheet" crossorigin href="/assets/index-CMlGQMcl.css">
17
17
  </head>
18
18
  <body>
package/dist/server.js CHANGED
@@ -221817,7 +221817,7 @@ async function getSchemasForPostgres(connection, malloyConnection) {
221817
221817
  throw new Error("Postgres connection is required");
221818
221818
  }
221819
221819
  try {
221820
- const result = await malloyConnection.runSQL("SELECT schema_name FROM information_schema.schemata ORDER BY schema_name");
221820
+ const result = await malloyConnection.runSQL("SELECT row_to_json(t) as row FROM (SELECT schema_name FROM information_schema.schemata ORDER BY schema_name) t");
221821
221821
  const rows = standardizeRunSQLResult2(result);
221822
221822
  return rows.map((row) => {
221823
221823
  const typedRow = row;
@@ -222285,7 +222285,7 @@ async function listTablesForPostgres(connection, schemaName, malloyConnection, t
222285
222285
  throw new Error("Postgres connection is required");
222286
222286
  }
222287
222287
  try {
222288
- const result = await malloyConnection.runSQL(`SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = '${schemaName}' ${sqlInFilter("table_name", tableNames)} ORDER BY table_name, ordinal_position`);
222288
+ const result = await malloyConnection.runSQL(`SELECT row_to_json(t) as row FROM (SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = '${schemaName}' ${sqlInFilter("table_name", tableNames)} ORDER BY table_name, ordinal_position) t`);
222289
222289
  const rows = standardizeRunSQLResult2(result);
222290
222290
  return groupColumnRowsIntoTables(rows, (t) => `${schemaName}.${t}`);
222291
222291
  } catch (error) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/server",
3
3
  "description": "Malloy Publisher Server",
4
- "version": "0.0.178",
4
+ "version": "0.0.180",
5
5
  "main": "dist/server.js",
6
6
  "bin": {
7
7
  "malloy-publisher": "dist/server.js"
@@ -32,15 +32,15 @@
32
32
  "@azure/identity": "^4.13.0",
33
33
  "@azure/storage-blob": "^12.26.0",
34
34
  "@google-cloud/storage": "^7.16.0",
35
- "@malloydata/db-bigquery": "^0.0.369",
36
- "@malloydata/db-duckdb": "^0.0.369",
37
- "@malloydata/db-mysql": "^0.0.369",
38
- "@malloydata/db-postgres": "^0.0.369",
39
- "@malloydata/db-snowflake": "^0.0.369",
40
- "@malloydata/db-trino": "^0.0.369",
41
- "@malloydata/malloy": "^0.0.369",
42
- "@malloydata/malloy-sql": "^0.0.369",
43
- "@malloydata/render-validator": "^0.0.369",
35
+ "@malloydata/db-bigquery": "^0.0.370",
36
+ "@malloydata/db-duckdb": "^0.0.370",
37
+ "@malloydata/db-mysql": "^0.0.370",
38
+ "@malloydata/db-postgres": "^0.0.370",
39
+ "@malloydata/db-snowflake": "^0.0.370",
40
+ "@malloydata/db-trino": "^0.0.370",
41
+ "@malloydata/malloy": "^0.0.370",
42
+ "@malloydata/malloy-sql": "^0.0.370",
43
+ "@malloydata/render-validator": "^0.0.370",
44
44
  "@modelcontextprotocol/sdk": "^1.13.2",
45
45
  "@opentelemetry/api": "^1.9.0",
46
46
  "@opentelemetry/auto-instrumentations-node": "^0.57.0",
@@ -167,10 +167,11 @@ describe("listTablesForSchema", () => {
167
167
  },
168
168
  };
169
169
 
170
- it("queries information_schema.columns with correct schema", async () => {
170
+ it("queries information_schema.columns wrapped in row_to_json", async () => {
171
171
  const m = mockConnection(columnRows);
172
172
  const tables = await listTablesForSchema(conn, "public", m.conn);
173
173
 
174
+ expect(m.lastSQL).toContain("row_to_json");
174
175
  expect(m.lastSQL).toContain("information_schema.columns");
175
176
  expect(m.lastSQL).toContain("table_schema = 'public'");
176
177
  expect(tables).toHaveLength(2);
@@ -470,7 +471,7 @@ describe("getSchemasForConnection", () => {
470
471
  },
471
472
  };
472
473
 
473
- it("queries information_schema.schemata", async () => {
474
+ it("queries information_schema.schemata wrapped in row_to_json", async () => {
474
475
  const rows = [
475
476
  { schema_name: "public" },
476
477
  { schema_name: "information_schema" },
@@ -480,6 +481,7 @@ describe("getSchemasForConnection", () => {
480
481
  const m = mockConnection(rows);
481
482
  const schemas = await getSchemasForConnection(conn, m.conn);
482
483
 
484
+ expect(m.lastSQL).toContain("row_to_json");
483
485
  expect(m.lastSQL).toContain("information_schema.schemata");
484
486
  expect(schemas).toHaveLength(4);
485
487
  expect(schemas.find((s) => s.name === "public")?.isDefault).toBe(true);
@@ -175,8 +175,10 @@ async function getSchemasForPostgres(
175
175
  throw new Error("Postgres connection is required");
176
176
  }
177
177
  try {
178
+ // Wrap in row_to_json because the Malloy Postgres driver's runSQL
179
+ // de-JSONs each row via row.row (matching Malloy-generated queries).
178
180
  const result = await malloyConnection.runSQL(
179
- "SELECT schema_name FROM information_schema.schemata ORDER BY schema_name",
181
+ "SELECT row_to_json(t) as row FROM (SELECT schema_name FROM information_schema.schemata ORDER BY schema_name) t",
180
182
  );
181
183
  const rows = standardizeRunSQLResult(result);
182
184
  return rows.map((row: unknown) => {
@@ -946,8 +948,10 @@ async function listTablesForPostgres(
946
948
  throw new Error("Postgres connection is required");
947
949
  }
948
950
  try {
951
+ // Wrap in row_to_json because the Malloy Postgres driver's runSQL
952
+ // de-JSONs each row via row.row (matching Malloy-generated queries).
949
953
  const result = await malloyConnection.runSQL(
950
- `SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = '${schemaName}' ${sqlInFilter("table_name", tableNames)} ORDER BY table_name, ordinal_position`,
954
+ `SELECT row_to_json(t) as row FROM (SELECT table_name, column_name, data_type FROM information_schema.columns WHERE table_schema = '${schemaName}' ${sqlInFilter("table_name", tableNames)} ORDER BY table_name, ordinal_position) t`,
951
955
  );
952
956
  const rows = standardizeRunSQLResult(result);
953
957
  return groupColumnRowsIntoTables(rows, (t) => `${schemaName}.${t}`);