A data engineer has a Python notebook in Databricks, but they need to use SQL to accomplish a specific task within a cell. They still want all of the other cells to use Python without making any changes to those cells.
Which of the following describes how the data engineer can use SQL within a cell of their Python notebook?
Suggested Answer: D
Get Premium Databricks Certified Data Engineer Associate Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
21 comments · newest first
BA
Bambi
10 months ago
Wait, really? You can just add %sql? That’s cool!
MI
Micah
11 months ago
Changing the whole notebook to SQL seems unnecessary.
WI
Willodean
11 months ago
Definitely %sql for SQL queries in Python cells!
BE
Belen
11 months ago
I thought you couldn't mix languages in a notebook?
FI
Filiberto
11 months ago
You can use %sql in a Python cell, super handy!
KR
Kristin
12 months ago
I feel like changing the default language of the notebook to SQL might not be the right approach, but I can't recall the exact details.
OL
Olen
12 months ago
I practiced a question similar to this, and I think the answer was about changing the cell type with a specific command.
MA
Mari
12 months ago
I’m not entirely sure, but I think you can’t just write SQL directly in a Python cell without some kind of prefix.
EM
Emogene
1 year ago
I remember something about using magic commands in notebooks, maybe adding %sql at the start of a cell?
JO
Jodi
1 year ago
The key here is that the data engineer wants to use SQL in a specific cell, while keeping the rest of the notebook in Python. Based on that, I think the best approach is to use the %sql magic command, which is option D.
MY
Myong
1 year ago
Okay, let me think this through step-by-step. The question says we want to use SQL in a Python notebook, without changing the other cells. That means we need a way to switch the language just for that specific cell. I'm pretty sure the %sql magic command is the way to do that.
MA
Markus
1 year ago
Hmm, I'm a little unsure about this one. I know we can use SQL in Databricks notebooks, but I'm not sure of the exact syntax. I'll have to think this through carefully.
KI
Kizzy
1 year ago
This seems like a pretty straightforward question. I'm pretty confident the answer is D - adding %sql to the first line of the cell.
RO
Robt
1 year ago
I'm a bit confused by this question. I thought Databricks notebooks were either Python or SQL, not a mix. But if we can use SQL in a Python notebook, then I guess the answer must be D - adding %sql to the cell.
AN
Andra
1 year ago
Okay, I remember that Type 4 LSAs are used to advertise ASBR routers. Since R1 is the ASBR, it should be generating the Type 4 LSA.
LA
Lauran
1 year ago
Okay, I've got this. The key is to make sure the product owner is fully on board with the business requirements. That's the best way to ensure the end product meets their needs.
HU
Hubert
2 years ago
That could be a possibility too, but I'm still leaning towards C)
WI
Wilda
2 years ago
But wouldn't changing the default language to SQL also work?
CA
Carman
2 years ago
I believe the correct answer is B) They can attach the cell to a SQL endpoint rather than a Databricks cluster.
HU
Hubert
2 years ago
I disagree, I think it's C) They can simply write SQL syntax in the cell.
WI
Wilda
2 years ago
I think the answer is D) They can add %sql to the first line of the cell.