Skip to main content

Installation

pip install in your Databricks Notebook

%pip install dlt_sidestep

Example Usage

Note: You must define a pipeline_id variable as spark.conf.get("pipelines.id", None)

Note: You must define a g variable as globals()

`

from pyspark.sql.functions import *

from pyspark.sql.types import *

from dlt_sidestep import SideStep



pipeline_id =  spark.conf.get("pipelines.id", None)

g = globals()



if pipeline_id:

  import dlt



json_path = "/databricks-datasets/wikipedia-datasets/data-001/clickstream/raw-uncompressed-json/2015_2_clickstream.json"



step = """

@dlt.create_table(

  comment="The raw wikipedia click stream dataset, ingested from /databricks-datasets.",

  table_properties={

    "quality": "bronze"

  }

)

def clickstream_raw():

  return (

    spark.read.option("inferSchema", "true").json(json_path)

  )

"""

SideStep(step, pipeline_id, g)

df = clickstream_raw()

df.display()





step = """

@dlt.create_table(

  comment="Wikipedia clickstream dataset with cleaned-up datatypes / column names and quality expectations.",

  table_properties={

    "quality": "silver"

  }

)

@dlt.expect("valid_current_page", "current_page_id IS NOT NULL AND current_page_title IS NOT NULL")

@dlt.expect_or_fail("valid_count", "click_count > 0")

def clickstream_clean():

  return (

    dlt.read("clickstream_raw")

      .withColumn("current_page_id", expr("CAST(curr_id AS INT)"))

      .withColumn("click_count", expr("CAST(n AS INT)"))

      .withColumn("previous_page_id", expr("CAST(prev_id AS INT)"))

      .withColumnRenamed("curr_title", "current_page_title")

      .withColumnRenamed("prev_title", "previous_page_title")

      .select("current_page_id", "current_page_title", "click_count", "previous_page_id", "previous_page_title")

  )

"""

SideStep(step, pipeline_id, g)

df = clickstream_clean()

df.display()

Release files for dlt-sidestep 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dlt-sidestep 0.0.8
File Size Uploaded
dlt_sidestep-0.0.8.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dlt-sidestep 0.0.8
File Interpreter ABI Platform
dlt_sidestep-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 7.8 kB

Release files / dlt_sidestep-0.0.8.tar.gz

Download URL dlt_sidestep-0.0.8.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0d4ef726fbe11ed38ec1ab3021e62aee83a6eba86922f495b72bdfe5d6395121
BLAKE2b-256 checksum
How to use checksums
0b26f715b7c2d0575626b9a10a61e5479bfb4b1408713f1adde8994346a2c3c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.8

Release files / dlt_sidestep-0.0.8-py3-none-any.whl

Download URL dlt_sidestep-0.0.8-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f268b13eb581e1dd2ac2376c8e543c1c3be6e8f903bea27b3e47a7a316915e54
BLAKE2b-256 checksum
How to use checksums
d33164972a55cad3bdf16d6bb988ff76e5a3f061ddcde0ee04ad6737f9b7d4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.8.8

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release 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