dataframe - sql syntax error in python cell

arkiboys 9,686 Reputation points
2022-04-05T10:34:40.247+00:00

Hello,
The below %sql cell executes without issues and returns data.
In the next cell (python cell) I am trying to use the same sql to write to dataframe but it does not seem to accept the sql.
Can you help please?
Thank you

Azure Databricks
Azure Databricks
An Apache Spark-based analytics platform optimized for Azure.
2,080 questions
0 comments No comments
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 85,746 Reputation points Microsoft Employee
    2022-04-06T08:08:35.327+00:00

    Hello @arkiboy,

    Thanks for the question and using MS Q&A platform.

    Error: When I tried the above query with single quotes around the sql command, I had received same error as shown:

    190426-image.png

    Success: When I tried the above query with double quotes around the sql command, it worked as excepted.

    190427-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    0 comments No comments

0 additional answers

Sort by: Most helpful