-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added example notebook doe scan using source data formats
- Loading branch information
souravg-db
committed
Dec 28, 2023
1 parent
e0fa1ca
commit 346d498
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Databricks notebook source | ||
# MAGIC %md | ||
# MAGIC # Scan Tables with User Specified Data Source Formats | ||
|
||
# COMMAND ---------- | ||
|
||
# MAGIC %md | ||
# MAGIC ### Declare Variables | ||
|
||
# COMMAND ---------- | ||
|
||
dbutils.widgets.text("catalogs", "*", "Catalogs") | ||
dbutils.widgets.text("schemas", "*", "Schemas") | ||
dbutils.widgets.text("tables", "*", "Tables") | ||
|
||
# COMMAND ---------- | ||
|
||
catalogs = dbutils.widgets.get("catalogs") | ||
schemas = dbutils.widgets.get("schemas") | ||
tables = dbutils.widgets.get("tables") | ||
from_table_statement = ".".join([catalogs, schemas, tables]) | ||
|
||
# COMMAND ---------- | ||
|
||
# MAGIC %md | ||
# MAGIC ### Initiaize discoverx | ||
|
||
# COMMAND ---------- | ||
|
||
from discoverx import DX | ||
|
||
dx = DX() | ||
|
||
# COMMAND ---------- | ||
|
||
# MAGIC %md | ||
# MAGIC ### DiscoverX will scan all delta tables by default | ||
|
||
# COMMAND ---------- | ||
|
||
dx.from_tables(from_table_statement).scan() | ||
|
||
# COMMAND ---------- | ||
|
||
# MAGIC %md | ||
# MAGIC ### User can specify data source formats as follows | ||
|
||
# COMMAND ---------- | ||
|
||
(dx.from_tables(from_table_statement) | ||
.with_data_source_formats(["DELTA","JSON"]) | ||
.scan()) | ||
|
||
# COMMAND ---------- | ||
|
||
|