How to create temporary table in databricks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2023 12:17 AM
Hi Team,
I have a requirement where I need to create temporary table not temporary view.
Can you tell me how to create temporary table in data bricks ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2024 11:13 AM
Can you share why you want a table instead of a view? I use createOrReplaceGlobalTempView if I need my temp view in other notebooks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 09:14 PM
Hi mano7438,
CREATE TEMPORARY TABLE my_table
USING <CSV>
OPTIONS (
path 'dbfs:/<path-to-your-file>/file.tsv',
delimiter '\t',
header 'true'
)
or
CREATE TEMPORARY TABLE temp_table (id int) using parquet;
Note: CREATE TEMPORARY TABLE without a provider is not allowed.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2024 10:12 PM
I just learnt, the above is a LEGACY support and hence must not be used. This isn't supported syntax, so there would be a lot of restrictions on the usage of this.
Internally it is just a view and hence we should go for create temp view instead.
I know your question was sometime back(so for newer visits to this query), I would like to understand, are you wanting to migrate and it blocks you somehow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 12:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2024 05:03 PM
I see, thanks for sharing, can you mark the solution which worked for you @abueno as Accepted.

