Big Data News Hubb
Advertisement
  • Home
  • Big Data
  • News
  • Contact us
No Result
View All Result
  • Home
  • Big Data
  • News
  • Contact us
No Result
View All Result
Big Data News Hubb
No Result
View All Result
Home Big Data

Debug your code and notebooks by using Visual Studio Code

admin by admin
June 13, 2023
in Big Data


Earlier this year we launched the official Databricks extension for Visual Studio Code. Today we are adding support for interactive debugging and local Jupyter (ipynb) notebook development using this extension!

Interactive debugging with Databricks Connect

Data scientists and data engineers typically rely on print statements or logs to identify errors in their code which can be time-consuming and error-prone. With support for interactive debugging using Databricks Connect, developers can step through their code and inspect variables in real time. Databricks Connect enables running Spark code on remote clusters from the IDE, thereby enabling code step-through while debugging.

Databricks Connect

After you have set up your extension to use Databricks Connect (see “Easy Setup” below), simply use the VS Code “Debug Python File” button to start debugging. You can add breakpoints and step through your code as you would any other Python file. You also have the ability to inspect variables or run debug commands in the debug console.

Support for ipynb notebooks

With this release, you can use the existing notebook functionality (such as running cell-by-cell execution for your exploratory data analysis) in Visual Studio Code as it supports the open ipynb format.

ipynb notebooks

Support for DBUtils and Spark SQL

Additionally, you can run Spark SQL and have limited support for running the popular tool “dbutils”. You can import dbutils using the following code block:


from databricks.sdk.runtime import *
dbutils.fs.ls(".")

Easy setup

The feature will be enabled by default soon, but for now you need to enable it manually:

  1. Under the command palette type in “Preferences Open Settings (UI)”.
  2. Under the “Workspace” tab search for “Databricks” and select “Databricks > Experiments: Opt Into”
  3. Enter “debugging.dbconnect” – it should be available as an autocomplete option
  4. Reload VS Code and you will see a small red banner at the bottom: “Databricks Connect disabled”
  5. Once you click it, you will be prompted to install Databricks Connect into your virtual environment.
Enable DB Connect in Visual Studio Code
Enable DB Connect in Visual Studio Code
Install DB Connect into your virtual environment
Install DB Connect into your virtual environment

Configuring your Spark session

As long as your Visual Studio extension is configured, your spark session will be initialized using your existing settings to connect to your remote cluster. You can get a reference to it using the snippet below:


from databricks.connect import DatabricksSession
spark = DatabricksSession.builder.getOrCreate()
df = spark.read.table("samples.nyctaxi.trips")
df.show(5)

Try out interactive debugging today, using a regular Python file or using an ipynb notebook to develop your Python code!

Download the VS Code Extension from the Visual Studio Marketplace

Please take a look at our documentation for AWS, Azure, and GCP for help with how to get started using the extension, and give it a try.

We would love to hear your feedback at the Databricks Community about this extension or any other aspect of the development experience.



Source link

Previous Post

Improve table readability and identify outliers with data bars in Amazon QuickSight

Next Post

Heard on the Street – 6/12/2023

Next Post

Heard on the Street – 6/12/2023

Recommended

The Solution to the Data Silo Trap

April 15, 2023

DataStax Bolsters Real-Time Machine Learning with Kaskada Buy

January 18, 2023

Top Data Science Ph.D. Dissertations (2019-2020)

May 11, 2023

Don't miss it

News

Oxford Researchers Use AI To Detect Antibiotic Resistance Faster Than Gold-Standard Testing

November 29, 2023
News

Enhancing User Experience in Online Business: Leveraging React JS for Progressive Web Applications (PWAs)

November 29, 2023
Big Data

5 Key Takeaways from Flink Forward 2023

November 28, 2023
Big Data

Heard on the Street – 11/27/2023

November 28, 2023
Big Data

How custom LLMs can turbocharge operations while protecting valuable IP

November 28, 2023
News

Improve performance of workloads containing repetitive scan filters with multidimensional data layout sort keys in Amazon Redshift

November 28, 2023
big-data-footer-white

© Big Data News Hubb All rights reserved.

Use of these names, logos, and brands does not imply endorsement unless specified. By using this site, you agree to the Privacy Policy and Terms & Conditions.

Navigate Site

  • Home
  • Big Data
  • News
  • Contact us

Newsletter Sign Up

No Result
View All Result
  • Home
  • Big Data
  • News
  • Contact us

© 2022 Big Data News Hubb All rights reserved.