cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

SELECT from table saved under path

johnb1
Contributor

Hi!

I saved a dataframe as a delta table with the following syntax:

(test_df
  .write
  .format("delta")
  .mode("overwrite")
  .save(output_path)
)

How can I issue a SELECT statement on the table?

What do I need to insert into [table_name] below?

SELECT * FROM [table_name]

4 REPLIES 4

Ajay-Pandey
Esteemed Contributor III

Hi @John B​ there is two way to access your delta table-

SELECT * FROM delta.`your_delta_table_path`
df.write.format("delta").mode("overwrite").option("path", "your_path").saveAsTable("table_name")

Now you can use your select query-

SELECT * FROM [table_name]

Ajay Kumar Pandey

Hi @Ajay Pandey​ 

When trying the first option I get:

image.pngimage

Ajay-Pandey
Esteemed Contributor III

Hi @John B​ in the above code instead of your path variable put your absolute path. Please refer to snapshot-

image.png

Ajay Kumar Pandey

Ajay-Pandey
Esteemed Contributor III

image.pngimage.png

Ajay Kumar Pandey

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