1- import { globalCallbacksList , IBDDataResponse } from "../boilingdata/boilingdata.api" ;
1+ import { EEngineTypes , globalCallbacksList , IBDDataResponse } from "../boilingdata/boilingdata.api" ;
22import { BoilingData , isDataResponse } from "../boilingdata/boilingdata" ;
33import { createLogger } from "bunyan" ;
44
@@ -23,7 +23,7 @@ globalCallbacks.onSocketClose = () => {
2323} ;
2424const bdInstance = new BoilingData ( { username, password, globalCallbacks, logLevel } ) ;
2525
26- describe ( "boilingdata" , ( ) => {
26+ describe ( "boilingdata with DuckDB " , ( ) => {
2727 beforeAll ( async ( ) => {
2828 await bdInstance . connect ( ) ;
2929 logger . info ( "connected." ) ;
@@ -39,6 +39,7 @@ describe("boilingdata", () => {
3939 const r : any [ ] = [ ] ;
4040 bdInstance . execQuery ( {
4141 sql : `SELECT * FROM parquet_scan('s3://boilingdata-demo/demo2.parquet:m=0') LIMIT 2;` ,
42+ // engine: EEngineTypes.DUCKDB, // DuckDB is the default
4243 keys : [ ] ,
4344 callbacks : {
4445 onData : ( data : IBDDataResponse | unknown ) => {
@@ -57,6 +58,7 @@ describe("boilingdata", () => {
5758 const r : any [ ] = [ ] ;
5859 bdInstance . execQuery ( {
5960 sql : `SELECT 's3://KEY' AS key, COUNT(*) AS count FROM parquet_scan('s3://KEY');` ,
61+ engine : EEngineTypes . DUCKDB ,
6062 keys : [ "s3://boilingdata-demo/demo.parquet" , "s3://boilingdata-demo/demo2.parquet" ] ,
6163 callbacks : {
6264 onData : ( data : IBDDataResponse | unknown ) => {
@@ -85,6 +87,7 @@ describe("boilingdata", () => {
8587 bdInstance . execQuery ( {
8688 sql,
8789 keys : [ ] ,
90+ engine : EEngineTypes . DUCKDB ,
8891 callbacks : {
8992 onData : ( data : IBDDataResponse | unknown ) => {
9093 if ( isDataResponse ( data ) ) data . data . map ( row => r . push ( row ) ) ;
@@ -99,3 +102,34 @@ describe("boilingdata", () => {
99102 expect ( rows . sort ( ) ) . toMatchSnapshot ( ) ;
100103 } ) ;
101104} ) ;
105+
106+ describe ( "boilingdata with SQLite3" , ( ) => {
107+ beforeAll ( async ( ) => {
108+ await bdInstance . connect ( ) ;
109+ logger . info ( "connected." ) ;
110+ } ) ;
111+
112+ afterAll ( async ( ) => {
113+ await bdInstance . close ( ) ;
114+ logger . info ( "connection closed." ) ;
115+ } ) ;
116+
117+ it ( "run single query" , async ( ) => {
118+ const rows = await new Promise < any [ ] > ( ( resolve , reject ) => {
119+ const r : any [ ] = [ ] ;
120+ bdInstance . execQuery ( {
121+ sql : `SELECT * FROM sqlite('s3://boilingdata-demo/uploads/userdata1.sqlite3','userdata1') LIMIT 2;` ,
122+ engine : EEngineTypes . SQLITE ,
123+ keys : [ ] ,
124+ callbacks : {
125+ onData : ( data : IBDDataResponse | unknown ) => {
126+ if ( isDataResponse ( data ) ) data . data . map ( row => r . push ( row ) ) ;
127+ resolve ( r ) ;
128+ } ,
129+ onLogError : ( data : any ) => reject ( data ) ,
130+ } ,
131+ } ) ;
132+ } ) ;
133+ expect ( rows . sort ( ) ) . toMatchSnapshot ( ) ;
134+ } ) ;
135+ } ) ;
0 commit comments