@malloydata/db-mysql 0.0.239-dev250226010331 → 0.0.239-dev250227145856
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.
|
@@ -32,12 +32,8 @@ describe('MySQL Connection', () => {
|
|
|
32
32
|
it('fetches schema for SQL block', async () => {
|
|
33
33
|
var _a;
|
|
34
34
|
const res = await connection.fetchSchemaForSQLStruct({
|
|
35
|
-
name: 'foo',
|
|
36
|
-
type: 'sql_select',
|
|
37
35
|
selectStr: 'SELECT 1 as one',
|
|
38
36
|
connection: 'mysql',
|
|
39
|
-
fields: [],
|
|
40
|
-
dialect: 'mysql',
|
|
41
37
|
}, {});
|
|
42
38
|
expect((_a = res.structDef) === null || _a === void 0 ? void 0 : _a.fields[0].name).toBe('one');
|
|
43
39
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, MalloyQueryData, PersistSQLResults, PooledConnection, QueryRunStats, RunSQLOptions, StreamingConnection, QueryOptionsReader, SQLSourceDef, TableSourceDef } from '@malloydata/malloy';
|
|
1
|
+
import { Connection, MalloyQueryData, PersistSQLResults, PooledConnection, QueryRunStats, RunSQLOptions, StreamingConnection, QueryOptionsReader, SQLSourceDef, TableSourceDef, SQLSourceRequest } from '@malloydata/malloy';
|
|
2
2
|
import { BaseConnection } from '@malloydata/malloy/connection';
|
|
3
3
|
import * as MYSQL from 'mysql2/promise';
|
|
4
4
|
export interface MySQLConfiguration {
|
|
@@ -29,7 +29,7 @@ export declare class MySQLConnection extends BaseConnection implements Connectio
|
|
|
29
29
|
close(): Promise<void>;
|
|
30
30
|
estimateQueryCost(_sqlCommand: string): Promise<QueryRunStats>;
|
|
31
31
|
fetchTableSchema(tableName: string, tablePath: string): Promise<TableSourceDef>;
|
|
32
|
-
fetchSelectSchema(sqlRef:
|
|
32
|
+
fetchSelectSchema(sqlRef: SQLSourceRequest): Promise<SQLSourceDef>;
|
|
33
33
|
private schemaFromResult;
|
|
34
34
|
runRawSQL(sql: string, _options?: RunSQLOptions): Promise<MalloyQueryData>;
|
|
35
35
|
static removeNulls(jsonObj: any): any;
|
package/dist/mysql_connection.js
CHANGED
|
@@ -147,8 +147,11 @@ class MySQLConnection extends connection_1.BaseConnection {
|
|
|
147
147
|
}
|
|
148
148
|
async fetchSelectSchema(sqlRef) {
|
|
149
149
|
const structDef = {
|
|
150
|
+
type: 'sql_select',
|
|
150
151
|
...sqlRef,
|
|
151
|
-
|
|
152
|
+
dialect: this.dialectName,
|
|
153
|
+
fields: [],
|
|
154
|
+
name: (0, malloy_1.sqlKey)(sqlRef.connection, sqlRef.selectStr),
|
|
152
155
|
};
|
|
153
156
|
const tempTableName = `tmp${(0, crypto_1.randomUUID)()}`.replace(/-/g, '');
|
|
154
157
|
const client = await this.getClient();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@malloydata/db-mysql",
|
|
3
|
-
"version": "0.0.239-
|
|
3
|
+
"version": "0.0.239-dev250227145856",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@malloydata/malloy": "^0.0.239-
|
|
25
|
+
"@malloydata/malloy": "^0.0.239-dev250227145856",
|
|
26
26
|
"@types/node": "^22.7.4",
|
|
27
27
|
"fastestsmallesttextencoderdecoder": "^1.0.22",
|
|
28
28
|
"luxon": "^3.5.0",
|