cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Selective column loader unity catalog

vk217
Contributor

I am loading a table into a data frame using

 

df = spark.table(table_name)

 

Is there a way to load only the required columns? The table has more than 50+ columns and I only need a handful of column.

1 ACCEPTED SOLUTION

Accepted Solutions

daniel_sahal
Esteemed Contributor

@vk217 Simply just use select function, ex.

df = spark.read.table(table_name).select("col1", "col2", "col3")

View solution in original post

1 REPLY 1

daniel_sahal
Esteemed Contributor

@vk217 Simply just use select function, ex.

df = spark.read.table(table_name).select("col1", "col2", "col3")

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group