Reputation: 21
Ive created a SQL view in databricks ie.
create view [database].[view name] as select col1, col2 from [table]
How do I view and edit that create statement now?
I've tried show create table [database].[view name]
, which does return the create statement in unformatted text in the result window, which is a pain to reformat, especially if you have comments in the code and its a particularly large and complex query.
Then the only way i can see to edit that view is to copy that text into a new window, make changes and paste it beneath an alter view alter body statement.
Is there a simpler way to show and edit queries behind SQL view objects in databricks?
For example like in ssms where you can "Script View As", then change the create to an alter and change some things and run again to edit.
Upvotes: 2
Views: 4584
Reputation: 23
@Karthikeyan's answer is correct, except that the last part of getting the view's SQL definition into your computer's clipboard is the trickiest. Here's how I've been doing it:
The popup window disappears when the mouse is released.
Upvotes: 1
Reputation: 2334
We don't have direct option. But you can keep cursor on that result and get the formatted query and paste it another cell for editing .
Keep your cursor on :
You copy and paste it another cell for further edit :
Upvotes: 0