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:ย 

upload file/table to delta table using CLI

pshuk
New Contributor III

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.

2 REPLIES 2

Ayushi_Suthar
Databricks Employee
Databricks Employee

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

pshuk
New Contributor III

Thanks Ayushi. Quick question: How do I put this in python code?

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