upload file/table to delta table using CLI
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2024 08:09 AM
Hi,
I am using CLI to transfer local files to Databricks Volume. At the end of my upload, I want to create a meta table (storing file name, location, and some other information) and have it as a table on databricks Volume. I am not sure how to create a table using CLI. can anyone point me in the right direction.
TIA.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2024 01:08 PM
Hi @pshuk , Greetings!
We understand that you are looking for a CLI command to create a Table but at this moment Databricks doesn't support CLI command to create the table but you can use SQL Execution API -https://docs.databricks.com/api/workspace/statementexecution/executestatement to run the DDL statements against a SQL warehouse, here is an example:
POST https://<DATABRICKS INSTANCE>/api/2.0/sql/statements
Body - {
"warehouse_id": "warehouse-ID",
"statement": "CREATE TABLE <Catalog Name><Schema Name><Table Name>"
}
Authorisation - < PAT Token >
Note - While executing this API, the SQL warehouse should be in a running state or else the cmd will go into a PENDING state.
Please let me know if this helps and leave a like if you find this information useful. Follow-ups are appreciated.
Kudos
Ayushi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-17-2024 09:29 AM
Thanks Ayushi. Quick question: How do I put this in python code?