Home > OS >  Using one notebook to open second notebook and execute sql query in Databricks that will create tabl
Using one notebook to open second notebook and execute sql query in Databricks that will create tabl

Time:03-23

My task is to create in Databricks one notebook with python query that will open another notebook with sql query.

First notebook - 1note:

%python
%run "/folder/2note"

Second notebook - 2note:

%sql
CREATE TABLE IF NOT EXISTS `dw`.`test` (id INT,name STRING,nyear SHORT)

I was searching but still I don't know if it is possible, that first notebook active second notebook to create table.

I tried to run that query but it doesn't create any table. There aren't any errors just no resault.

CodePudding user response:

%run is used to pull code from the notebook with the same language. If you need to run notebook with another language, you can use dbutils.notebook.run function (see docs for all details)

  • Related