Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape table name to avoid filename replacement #299

Open
maxigit opened this issue May 27, 2022 · 0 comments
Open

Escape table name to avoid filename replacement #299

maxigit opened this issue May 27, 2022 · 0 comments

Comments

@maxigit
Copy link

maxigit commented May 27, 2022

I've just discover this utility and I am really impressed. It is so far the best utility I've found to play with csv.
However, there is a small improvement which I think is fairly small but will unlock many features.
As far as I understand, there is at the moment no support for subqueries. Subqueries can be really usefull for lots of reason but I came across this problem trying to use GROUP CONCAT with DISTINCT and SEPARATOR.
This si not supported at the moment by sqlite (problem with the parser) can in my case could be solved but using subqueries.
I understand subqueries might be difficult to parse, however sqlite support WITH statement which make subquery a breeze.

Instead of writing

SELECT * FROM <subquery>

one can write

WITH (<subquery) as sub1
SELECT * FROM sub1

This doesn't work with q because it attempts to find a file named sub1 instead of leaving it as it is.
What would solve the problem, I think, is to have a way to "escape" a table name so that q just ignore it and doesn't try to create a table from a file. The syntax I can think of would be something like prefixing with ! , \ etc or back quoting it, like

WITH (<subquery) as sub1
SELECT * FROM !sub1

or

SELECT * FROM \sub1

or

SELECT * FROM `sub1`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant