-
Notifications
You must be signed in to change notification settings - Fork 203
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
Allow using double-quotes for escaping. #303
Comments
Hey @codekitchen! You can escape keywords (and also complex file paths) using backticks. So in this case that would be: SELECT `key` FROM myfile.csv However, keep in mind that if you're using bash, you need to escape backticks, so the above becomes: octosql 'SELECT \`key\` FROM myfile.csv' That said, using double quotes for escaping is a good idea (following the SQL standard, as you said). Thanks for it! It would also partially solve #295. I'll update the issue title to track adding this (changing from the current behaviour of treating double-quotes as string literals). |
aha, thank you. and 👍 on allowing double-quotes as is standard. one note: escaping the backticks isn't necessary in bash (and zsh) if you wrap the whole query in single-quotes, e.g. this works fine: octosql 'select `key` from myfile.csv' but if wrapping in double-quotes, you do need to escape the backticks: octosql "select \`key\` from myfile.csv" |
@codekitchen FYI double quotes for literals have been released as part of v0.12.0. |
I have a csv file that has a column named
key
, which seems to be a reserved word in octosql?select key from myfile.csv
errors withError: couldn't parse query: invalid argument syntax error at position 11 near 'key'
I tried escaping the identifier with double-quotes following the SQL standard, but that seems to actually create a string literal in octosql, same as with single-quotes?
I also tried brackets (
select [key] from
) but that errors as well. Is there a way to escape identifiers that I am missing in the docs? Thanks!The text was updated successfully, but these errors were encountered: