Skip to main content

DiscoverX

Multi-table operations over the lakehouse.

Multi-table operations

Run a single command to execute operations across many tables.

Operations examples

Operations are applied concurrently across multiple tables

Getting started

Install DiscoverX, in Databricks notebook type

%pip install dbl-discoverx

Get started

from discoverx import DX
dx = DX(locale="US")

You can now run operations across multiple tables.

As an illustration, consider the scenario where you need to retrieve a single row from various tables within a catalog that begins with "dev_" and includes the term "sample" in their names. To achieve this, the following code block utilizes the dx.from_tables function, which applies an SQL query to extract JSON-formatted data:

dx.from_tables("dev_*.*.*sample*")\
  .apply_sql("SELECT to_json(struct(*)) AS row FROM {full_table_name} LIMIT 1")\
  .execute()

Available functionality

The available dx functions are

  • from_tables("<catalog>.<schema>.<table>") selects tables based on the specified pattern (use * as a wildcard). Returns a DataExplorer object with methods
    • having_columns restricts the selection to tables that have the specified columns
    • with_concurrency defines how many queries are executed concurrently (10 by defailt)
    • apply_sql applies a SQL template to all tables. After this command you can apply an action. See in-depth documentation here.
    • unpivot_string_columns returns a melted (unpivoted) dataframe with all string columns from the selected tables. After this command you can apply an action
    • scan (experimental) scans the lakehouse with regex expressions defined by the rules and to power the semantic classification.
  • intro gives an introduction to the library
  • scan scans the lakehouse with regex expressions defined by the rules and to power the semantic classification. Documentation
  • display_rules shows the rules available for semantic classification
  • search searches the lakehouse content for by leveraging the semantic classes identified with scan (eg. email, ip address, etc.). Documentation
  • select_by_class selects data from the lakehouse content by semantic class. Documentation
  • delete_by_class deletes from the lakehouse by semantic class. Documentation

from_tables Actions

After a apply_sql or unpivot_string_columns command, you can apply the following actions:

  • explain explains the queries that would be executed
  • execute executes the queries and shows the result in a unioned dataframe
  • to_union_dataframe unions all the dataframes that result from the queries

Requirements

Project Support

Please note that all projects in the /databrickslabs github account are provided for your exploration only, and are not formally supported by Databricks with Service Level Agreements (SLAs). They are provided AS-IS and we do not make any guarantees of any kind. Please do not submit a support ticket relating to any issues arising from the use of these projects.

Any issues discovered through the use of this project should be filed as GitHub Issues on the Repo. They will be reviewed as time permits, but there are no formal SLAs for support.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dbl_discoverx-0.0.6.tar.gz (24.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dbl_discoverx-0.0.6-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file dbl_discoverx-0.0.6.tar.gz.

File metadata

  • Download URL: dbl_discoverx-0.0.6.tar.gz
  • Upload date:
  • Size: 24.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dbl_discoverx-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b4364e7e81fd0519b406f3f804164c030d7a8e0dfd20d2e708c453ea51dd4f81
MD5 2cba592521403988e5b41c37e5b9d6dd
BLAKE2b-256 0334a8434a179e76a0c36d5f431a20024659edc77fe4439e45869adef65d6d67

See more details on using hashes here.

File details

Details for the file dbl_discoverx-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: dbl_discoverx-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for dbl_discoverx-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e2d033ec50e5adf8d0bd447927dd3d42d187250305857b10c0ae9d0bbb876d5c
MD5 ff82cda6d5449ef5d6d828246cbfc36b
BLAKE2b-256 295f37951476ed3c17dc0d54d52151cce1d227af3240c2fe4a12550f35997b78

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

This release

0.0.6 This release

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page