davidkhala / databricks-common

databricks code tool
0 stars 0 forks source link

code stash: refactor project structure #2

Open davidkhala opened 1 week ago

davidkhala commented 1 week ago

lineage.py

# MAGIC %sql 
# MAGIC -- assume Global Temp view exist
# MAGIC CREATE WIDGET TEXT notebooks_dimension_table_name DEFAULT "notebooks_dimension";
# MAGIC
# MAGIC select * from global_temp.${notebooks_dimension_table_name}

# COMMAND ----------
def get_column_lineage(table_name):

    response = requests.get(
        API_URL + '/api/2.0/lineage-tracking/column-lineage',
        headers={"Authorization": "Bearer " + TOKEN},
        data=json.dumps({'table_name':table_name})
    ).json()

    return response

get_column_lineage(dbutils.widgets.get("table_name"))
davidkhala commented 1 week ago
%sql 
-- assume Global Temp view exist
CREATE WIDGET TEXT notebooks_dimension_table_name DEFAULT "notebooks_dimension";

select * from global_temp.:notebooks_dimension