SELECT from table saved under path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 06:04 AM
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 08:20 AM
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]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 08:49 AM
Hi @Ajay Pandey
When trying the first option I get:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 08:49 PM
Hi @John B in the above code instead of your path variable put your absolute path. Please refer to snapshot-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 08:59 PM