@malloydata/db-duckdb 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.
@@ -194,11 +194,7 @@ const makeStructDef = () => {
194
194
  //
195
195
  // Uses string value for table
196
196
  const SQL_BLOCK_1 = {
197
- type: 'sql_select',
198
- name: 'block1',
199
- dialect: 'duckdb',
200
197
  connection: 'duckdb',
201
- fields: [],
202
198
  selectStr: `
203
199
  SELECT
204
200
  created_at,
@@ -215,11 +211,7 @@ FROM "inventory_items.parquet"
215
211
  };
216
212
  // Uses read_parquet() for table
217
213
  const SQL_BLOCK_2 = {
218
- type: 'sql_select',
219
- name: 'block2',
220
- dialect: 'duckdb',
221
214
  connection: 'duckdb',
222
- fields: [],
223
215
  selectStr: `
224
216
  SELECT
225
217
  created_at,
@@ -1,4 +1,4 @@
1
- import { MalloyQueryData, PersistSQLResults, PooledConnection, QueryDataRow, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, StructDef, TestableConnection, SQLSourceDef, TableSourceDef } from '@malloydata/malloy';
1
+ import { MalloyQueryData, PersistSQLResults, PooledConnection, QueryDataRow, QueryOptionsReader, QueryRunStats, RunSQLOptions, StreamingConnection, StructDef, TestableConnection, SQLSourceDef, TableSourceDef, SQLSourceRequest } from '@malloydata/malloy';
2
2
  import { BaseConnection } from '@malloydata/malloy/connection';
3
3
  export interface DuckDBQueryOptions {
4
4
  rowLimit: number;
@@ -26,7 +26,7 @@ export declare abstract class DuckDBCommon extends BaseConnection implements Tes
26
26
  }>;
27
27
  runSQL(sql: string, options?: RunSQLOptions): Promise<MalloyQueryData>;
28
28
  abstract runSQLStream(sql: string, options: RunSQLOptions): AsyncIterableIterator<QueryDataRow>;
29
- fetchSelectSchema(sqlRef: SQLSourceDef): Promise<SQLSourceDef | string>;
29
+ fetchSelectSchema(sqlRef: SQLSourceRequest): Promise<SQLSourceDef | string>;
30
30
  estimateQueryCost(_: string): Promise<QueryRunStats>;
31
31
  fillStructDefFromTypeMap(structDef: StructDef, typeMap: {
32
32
  [name: string]: string;
@@ -84,7 +84,13 @@ class DuckDBCommon extends connection_1.BaseConnection {
84
84
  return { rows: result, totalRows: result.length };
85
85
  }
86
86
  async fetchSelectSchema(sqlRef) {
87
- const sqlDef = { ...sqlRef };
87
+ const sqlDef = {
88
+ type: 'sql_select',
89
+ ...sqlRef,
90
+ dialect: this.dialectName,
91
+ fields: [],
92
+ name: (0, malloy_1.sqlKey)(sqlRef.connection, sqlRef.selectStr),
93
+ };
88
94
  await this.schemaFromQuery(`DESCRIBE SELECT * FROM (${sqlRef.selectStr})`, sqlDef);
89
95
  return sqlDef;
90
96
  }
@@ -1,5 +1,5 @@
1
1
  import * as duckdb from '@duckdb/duckdb-wasm';
2
- import { FetchSchemaOptions, QueryDataRow, QueryOptionsReader, RunSQLOptions, SQLSourceDef, ConnectionConfig, TableSourceDef } from '@malloydata/malloy';
2
+ import { FetchSchemaOptions, QueryDataRow, QueryOptionsReader, RunSQLOptions, SQLSourceDef, ConnectionConfig, TableSourceDef, SQLSourceRequest } from '@malloydata/malloy';
3
3
  import { StructRow } from 'apache-arrow';
4
4
  import { DuckDBCommon } from './duckdb_common';
5
5
  /**
@@ -53,7 +53,7 @@ export declare abstract class DuckDBWASMConnection extends DuckDBCommon {
53
53
  }>;
54
54
  runSQLStream(sql: string, { rowLimit, abortSignal }?: RunSQLOptions): AsyncIterableIterator<QueryDataRow>;
55
55
  private findTables;
56
- fetchSchemaForSQLStruct(sqlRef: SQLSourceDef, options: FetchSchemaOptions): Promise<{
56
+ fetchSchemaForSQLStruct(sqlRef: SQLSourceRequest, options: FetchSchemaOptions): Promise<{
57
57
  structDef: SQLSourceDef;
58
58
  error?: undefined;
59
59
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/db-duckdb",
3
- "version": "0.0.239-dev250226010331",
3
+ "version": "0.0.239-dev250227145856",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -41,7 +41,7 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@duckdb/duckdb-wasm": "1.29.0",
44
- "@malloydata/malloy": "^0.0.239-dev250226010331",
44
+ "@malloydata/malloy": "^0.0.239-dev250227145856",
45
45
  "@motherduck/wasm-client": "^0.6.6",
46
46
  "apache-arrow": "^17.0.0",
47
47
  "duckdb": "1.1.1",