Skip to content
Advertisement

Escaped single quote ignored in SELECT clause

Not sure why the escaped single quote doesn’t appear in the SQL output. Initially tried this in Jupyter notebook, but reproduced it in PySpark shell below.

Output shows Bobs home instead of Bob's home

Advertisement

Answer

Use backslash instead of a single quote to escape a single quote:

Alternatively, you can use double quotes to surround the string, so that you don’t need to escape the single quote:

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement