exam questions

Exam DP-500 All Questions

View all questions & answers for the DP-500 exam

Exam DP-500 topic 1 question 29 discussion

Actual exam question from Microsoft's DP-500
Question #: 29
Topic #: 1
[All DP-500 Questions]

HOTSPOT -
You have an Azure Synapse workspace named Workspace1.
You need to use PySpark in a notebook to read data from a SQL pool as an Apache Spark DataFrame and display the top five rows.
How should you complete the code? To answer, select the appropriate options in the answer area.
NOTE: Each correct selection is worth one point.

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
KWaleed
Highly Voted 2 years, 6 months ago
spark.read.sqlanalytics() and spark_read.show(). You can see it from the following example notebook https://github.com/Azure-Samples/Synapse/blob/main/Notebooks/Scala/03%20Read%20and%20write%20from%20SQL%20pool%20table.ipynb
upvoted 22 times
...
AT96
Highly Voted 2 years, 6 months ago
Correct answer is .load and .show
upvoted 7 times
Az301301X
2 years, 6 months ago
honest question: why spark.read.sqlanalytics is wrong?
upvoted 2 times
Chk88
2 years, 6 months ago
the question pointing to more of a general thing, they did not specify synapse analytics...? thus use the general function
upvoted 1 times
Az301301X
2 years, 5 months ago
But it says: You have an "Azure Synapse" workspace named Workspace1. You need to use PySpark in a notebook to read data from a "SQL pool" as an Apache Spark DataFrame and display the top five rows. So, .sqlanalytics should work. Thoughts?
upvoted 2 times
ivanb94
2 years, 5 months ago
considering the link KWaleed provided, my thought is that the correct answer is definitely spark.read.sqlanalytics() and spark_read.show(). The fact that the question text emphasizes the Azure Synapse Workspace removes any doubts in my opinion.
upvoted 3 times
...
...
dev2dev
2 years, 1 month ago
indeed the code snipped is loading from managed table. so, no load but sqlanalytics
upvoted 1 times
...
...
...
dev2dev
2 years, 1 month ago
load is wrong. its for reading directly from storage account.
upvoted 2 times
...
...
Hisayuki
Most Recent 1 year, 9 months ago
read.sqlanalytics - to read dataframe from SQL read.load - to read dataframe from files such as parquet
upvoted 1 times
...
orionduo
1 year, 10 months ago
// Read the table we just created in the sql pool as a Spark dataframe val spark_read = spark.read. sqlanalytics(s"$sql_pool_name.dbo.PublicHoliday") spark_read.show(5, truncate = false)
upvoted 1 times
...
DarioReymago
2 years, 3 months ago
is load and show, I understand sqlanalytics is a complement wiht tools and constants
upvoted 1 times
...
[Removed]
2 years, 6 months ago
%%pyspark df = spark.read.load https://learn.microsoft.com/en-us/azure/synapse-analytics/get-started-analyze-spark
upvoted 2 times
...
Bob5379
2 years, 6 months ago
.sqlanalytics or synapsesql .show
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...