q icon indicating copy to clipboard operation
q copied to clipboard

Support spaces in tables/files names

Open Niluge-KiWi opened this issue 12 years ago • 10 comments

I haven't found a way to use files with spaces in their name: quoting with ", ', or ` doesn't work; escaping spaces with a backslash doesn't work either.

Niluge-KiWi avatar Sep 24 '13 15:09 Niluge-KiWi

Hi, yes, you're right it is a bug. I'll try to fix it as soon as possible.

Btw, which os are you using? On Sep 24, 2013 6:47 PM, "Thomas Riccardi" [email protected] wrote:

I haven't found a way to use files with spaces in their name: quoting with ", ', or ` doesn't work; escaping spaces with a backslash doesn't work either.

— Reply to this email directly or view it on GitHubhttps://github.com/harelba/q/issues/4 .

harelba avatar Sep 25 '13 07:09 harelba

Among other things Ubuntu 10.04.

Thanks.

Niluge-KiWi avatar Sep 25 '13 08:09 Niluge-KiWi

In standard ansi SQL you can use backticks to quote table and column names. Would be great if you could do that in q, too. E.g.:

    q "SELECT * FROM `a file with spaces.csv`"

kc14 avatar Nov 29 '18 15:11 kc14

@kc14 yeah, filenames with spaces are currently a limitation of q. I have plans to have a solution for it for a long time now, but haven't gotten to it.

harelba avatar Dec 01 '18 17:12 harelba

Ran into this again tonight. q is such a great utility. @harelba have any ideas for a fix to support spaces in names (I expected back ticks to work as that's the mechanism that works today for spaces in column names, but no joy).

contentfree avatar Apr 29 '21 04:04 contentfree

@contentfree They are working, but depending on your shell you have to quote or escape them correctly (e.g. see https://github.com/harelba/q/issues/94#issuecomment-273985876)

bitti avatar Apr 29 '21 06:04 bitti

Single quotes for the query and double quotes for the filename-with-spaces didn't work. Still breaks on spaces in the filename. I'll double check tomorrow that my version is the latest though.

On Apr 28, 2021, at 23:19, David Ongaro @.***> wrote:

 @contentfree They are working, but depending on your shell you have to quote or escape them correctly (e.g. see #94 (comment))

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

contentfree avatar Apr 29 '21 07:04 contentfree

unfortunately, my parsing logic doesn't support this for now.

I'm in the final phases of a huge upgrade for q which should be out soon, so i can't touch anything else for now.

I'll try to fix the issue immediately after the release.

harelba avatar Apr 29 '21 16:04 harelba

Exciting news!

contentfree avatar Apr 29 '21 17:04 contentfree

Single quotes for the query and double quotes for the filename-with-spaces didn't work. Still breaks on spaces in the filename. I'll double check tomorrow that my version is the latest though. On Apr 28, 2021, at 23:19, David Ongaro @.***> wrote:  @contentfree They are working, but depending on your shell you have to quote or escape them correctly (e.g. see #94 (comment)) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

I was referring to "spaces in column names", for filenames you're out of luck I'm afraid. In most shells you may try a workaround like

q "SELECT * FROM "<(cat "a file with spaces.csv")

or

q "SELECT * FROM -" <"a file with spaces.csv"

bitti avatar Apr 29 '21 18:04 bitti