Strings
Strings in PRQL can use either single or double quotes:
PRQL
from my_table
select x = "hello world"
SQL
SELECT
'hello world' AS x
FROM
my_table
PRQL
from my_table
select x = 'hello world'
SQL
SELECT
'hello world' AS x
FROM
my_table
To quote a string containing quotes, either use the “other” type of quote, or use 3, 4, 5 or 6 quotes, and close with the same number.
PRQL
from my_table
select x = '"hello world"'
SQL
SELECT
'"hello world"' AS x
FROM
my_table
PRQL
from my_table
select x = """I said "hello world"!"""
SQL
SELECT
'I said "hello world"!' AS x
FROM
my_table
PRQL
from my_table
select x = """""I said """hello world"""!"""""
SQL
SELECT
'I said """hello world"""!' AS x
FROM
my_table
Strings can also contain any escape defined by JSON standard.
PRQL
from my_table
select x = "\t\tline ends here\n \\ "
SQL
SELECT
' line ends here
\ ' AS x
FROM
my_table
F-Strings and S-Strings
These special case strings can be used to:
F-strings - Build up a new string from a set of columns or values
S-strings - Insert SQL statements directly into the query. Use when PRQL doesn’t have an equivalent facility.
Warning
Currently PRQL allows multiline strings with either a single character or multiple character quotes. This may change for strings using a single character quote in future versions.