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
Honored Contributor
Honored Contributor

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?

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!