@malloy-publisher/server 0.0.179 → 0.0.181
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.
- package/dist/app/assets/{HomePage-DRmAsRAP.js → HomePage-B0C6gwGj.js} +1 -1
- package/dist/app/assets/{MainPage-BLhfzy47.js → MainPage-B53xidTF.js} +1 -1
- package/dist/app/assets/{ModelPage-bgdjxhyc.js → ModelPage-UMuQe8qY.js} +1 -1
- package/dist/app/assets/{PackagePage-rPw0OAJY.js → PackagePage-BEDvm_je.js} +1 -1
- package/dist/app/assets/{ProjectPage-D0DYloUr.js → ProjectPage-DzN4P86H.js} +1 -1
- package/dist/app/assets/{RouteError-CsFH2AdT.js → RouteError-Cv58zNpb.js} +1 -1
- package/dist/app/assets/{WorkbookPage-CQ37Bfli.js → WorkbookPage-DZ1StqsX.js} +1 -1
- package/dist/app/assets/{index-C2IkGoJ8.js → index-D-xPyBUA.js} +3 -3
- package/dist/app/assets/{index-Cev5PtEG.js → index-DPThhVfX.js} +1 -1
- package/dist/app/assets/{index-DcnbmCmI.js → index-M3Zo817E.js} +168 -166
- package/dist/app/assets/index.umd-DnfBsVqO.js +1145 -0
- package/dist/app/index.html +1 -1
- package/dist/server.js +2 -2
- package/package.json +10 -10
- package/src/service/db_utils.spec.ts +4 -2
- package/src/service/db_utils.ts +6 -2
- package/dist/app/assets/index.umd-BwIMLH79.js +0 -1145
package/dist/app/index.html
CHANGED
|
@@ -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-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-D-xPyBUA.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.
|
|
4
|
+
"version": "0.0.181",
|
|
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.
|
|
36
|
-
"@malloydata/db-duckdb": "^0.0.
|
|
37
|
-
"@malloydata/db-mysql": "^0.0.
|
|
38
|
-
"@malloydata/db-postgres": "^0.0.
|
|
39
|
-
"@malloydata/db-snowflake": "^0.0.
|
|
40
|
-
"@malloydata/db-trino": "^0.0.
|
|
41
|
-
"@malloydata/malloy": "^0.0.
|
|
42
|
-
"@malloydata/malloy-sql": "^0.0.
|
|
43
|
-
"@malloydata/render-validator": "^0.0.
|
|
35
|
+
"@malloydata/db-bigquery": "^0.0.374",
|
|
36
|
+
"@malloydata/db-duckdb": "^0.0.374",
|
|
37
|
+
"@malloydata/db-mysql": "^0.0.374",
|
|
38
|
+
"@malloydata/db-postgres": "^0.0.374",
|
|
39
|
+
"@malloydata/db-snowflake": "^0.0.374",
|
|
40
|
+
"@malloydata/db-trino": "^0.0.374",
|
|
41
|
+
"@malloydata/malloy": "^0.0.374",
|
|
42
|
+
"@malloydata/malloy-sql": "^0.0.374",
|
|
43
|
+
"@malloydata/render-validator": "^0.0.374",
|
|
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
|
|
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);
|
package/src/service/db_utils.ts
CHANGED
|
@@ -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}`);
|