AlaSQL / node-red-contrib-alasql

A Node-RED node wrapping AlaSQL for fast SQL based in-memory data processing for BI and ERP applications.
MIT License
8 stars 11 forks source link

UNION ALL problem #11

Open hamild opened 7 years ago

hamild commented 7 years ago

AlaSQL node is very good but I'm having difficulty performing a UNION ALL when I do a Select on two spreadsheets (or two sheets from one spreadsheet). Node-red crashes with an uncaught exception error ... 30 Aug 11:23:53 - [red] Uncaught Exception: 30 Aug 11:23:53 - TypeError: Cannot read property 'data' of undefined at queryfn3 (C:\Users\IBM_ADMIN.node-red\node_modules\alasql\dist\alasql.fs.js:6401:11) at queryfn2 (C:\Users\IBM_ADMIN.node-red\node_modules\alasql\dist\alasql.fs.js:6305:9) at C:\Users\IBM_ADMIN.node-red\node_modules\alasql\dist\alasql.fs.js:15680:10 at C:\Users\IBM_ADMIN.node-red\node_modules\alasql\dist\alasql.fs.js:3591:21 at C:\Users\IBM_ADMIN.node-red\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)

I can read data from individual spreadsheets or tables but if I try the UNION it fails. Here's my SQL from within the node.. select from xlsx("c:\union.xlsx") union all select from xlsx("c:\union2.xlsx")

These are small (2 lines) worksheets and are exactly the same format (NAME, SURNAME, ID)

mathiasrw commented 7 years ago

Hi @hamild

You will have to load data into a table to make it work.

As both actions are async, I am not sure this can be done at the moment with the alasql node.

If you are interested I can coatch you on how to do this with a "regular" javascript node...

hamild commented 7 years ago

Hi Mathias. Thanks for your response. I had forgotten about loading data... I will try some variations on that first and see what happens :-)