AlaSQL / alasql

AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.
http://alasql.org
MIT License
7.02k stars 656 forks source link

alasql cli arguments don't seem to work on GitLabCI #1090

Open thom4parisot opened 5 years ago

thom4parisot commented 5 years ago

AlaSQL is based on unpaid voluntary work. Thank you for taking the time to make it better.

Thanks so much for providing this tool. I'm enjoying this discovery.


Something is not working as expected:

When I run alasql --file something.sql on GitLabCI, I am welcomed with this message:

No SQL to process

(see job output)

If I clone this repo locally with node@v10.15.0 and npm@v6.5.0, the same command npm test works.

If I do reuse the same image as on GitLabCI, with Docker, the same command npm test works.

docker run -ti --rm node:10 sh -c "git clone https://gitlab.com/oncletom/alasql-cli-arguments-issue.git && cd alasql-cli-arguments-issue && npm ci && npm test"

I created this repository to describe the problem: https://gitlab.com/oncletom/alasql-cli-arguments-issue, the command npm test fails.

If I feed the same file to alasql within a Node script, the problem does not happen.

I have not been able to reproduce this problem elsewhere.

mathiasrw commented 5 years ago

I am glad its doing something good for you.

I have a feeling its something about the working directory in the CI enviroment. The error comes when the files is empty or cant be found. If you do a cat something.sql do you get the right code?

thom4parisot commented 5 years ago

Yeah, that was my feeling too but if I do cat something.sql, echo $PWD and ls ., everything points in the direction that it's the correct working directory.

When you see an npm task prelude line, the last bit is its working directory:

> alasql-cli-arguments-issue@1.0.0 test /builds/oncletom/alasql-cli-arguments-issue

In the project I use alasql into, I use other Node.js-based CLI tools and they don't have any problem.

mathiasrw commented 5 years ago

Hmm. Very strange. I never really used gitlabCI. It should just work.

And you cant even pipe data into alasql.

Hmmmmmmmm.

thom4parisot commented 5 years ago

Yeah it's weird. I opened an issue here: https://gitlab.com/gitlab-org/gitlab-runner/issues/3950

I tried with alasql "$(cat correspondances.sql)" and it still thinks there is no input. Even when I had the plain query as alasql 'SELECT * INTO CSV(...) FROM XLS(...)', which worked perfectly fine on my computer.