csvq icon indicating copy to clipboard operation
csvq copied to clipboard

Support fully qualified file names in CREATE TABLE and INSERT commands

Open KayKursawe opened this issue 2 years ago • 3 comments

In SELECT statements, i can specify a fully qualified file to be queried, e. g. SELECT a, b, c FROM file:/foo/bar

However, in CREATE TABLE and INSERT statements (and probably a few others) this doesn't work. Instead, all that seems to work is to specifiy the filename without the leading path and without the trailing file extension as a table name: CREATE TABLE foo(a, b, c)

How about providing the file: notation consistently to all statements?

KayKursawe avatar May 22 '23 13:05 KayKursawe

Have you tried enclosing the filename in backticks?

SELECT a, b, c FROM `/foo/bar`

kpym avatar May 22 '23 15:05 kpym

SELECT is not an issue, fully qualified paths are working. I'm talking about CREATE TABLE and INSERT statements.

Since SELECT a, b, c FROM file:/foo/bar.csv is working using the file: notation, I'd be happy to use that in any other statement, too, like this: CREATE TABLE file:/foo/bar.csv(a, b, c) INSERT INTO file:/foo/bar.csv(a, b, c) VALUES (1, 2, 3)

Atm, this is the only way it works: CREATE TABLE foo(a, b, c) INSERT INTO foo(a, b, c) VALUES (1, 2, 3)

KayKursawe avatar May 24 '23 08:05 KayKursawe

The file specification in URL format is intended to be read-only. Therefore, it can currently be used only in SELECT queries. However, it is true that specifying local files in URL format is useful when creating or updating files. I'll consider supporting it.

mithrandie avatar Jun 05 '23 00:06 mithrandie