mechatroner / RBQL

🦜RBQL - Rainbow Query Language: SQL-like query engine for (not only) CSV file processing. Supports SQL queries with Python and JavaScript expressions.
https://rbql.org
MIT License
276 stars 13 forks source link

RBSQL Not Working in VSCode #39

Closed kupdegrove closed 1 year ago

kupdegrove commented 1 year ago

I'm running Rainbow CSV version 3.7.0 in VS Code 1.77.3 on Windows 10.0.1.10944 Build 19044. I have 3 pipe-delimited .csv files.

The RBSQL query function returns no results when it's clear that it should. The syntax is very simple and correct:
SELECT * WHERE a1 == "20" . The table clearly shows values of "20" in the RBSQL console but nothing returns in the result set. Oddly enough, a custom Javascript function I added to .rbql_init.source.js works as expected (correct results are returned):

function isNotAscii(str) {
    var regex = /[\x80-\xFF]/;
    var result = str.match(regex);
    if (result == null) {
        result = "False";
    } else {
        result = "True";
    }
    return result;
}

What I've tried: • Query on all three different files (no change) • Removing the custom function and reloading (no change) • Uninstalling and reinstalling the extension (no change) • Multiple OSs (Linux Mint 21.1, macOS Ventura 13.3.1)

mechatroner commented 1 year ago

Thanks for reporting, the problem is that for pipe-delimited files (unlike regular comma-separated csv files) double quote symbol has no special meaning. So in your file you need to query SELECT * WHERE a1 == '"20"' to literally find all "20" entries instead of 20. I might be able to add some guardrails to RBQL to automatically detect similar situations and report a warning.

kupdegrove commented 1 year ago

Thank you! That was indeed the issue.