cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Deployment-ready sample source-code for Delta Live Table & Autoloader

Sanjay_AMP
New Contributor II

Hi all,

We are planning to develop an Autoloader based DLT Pipeline that needs to be

  • Deployable via a CI/CD Pipeline
  • Observable

Can somebody please point me to source-code that we can start with a firm foundation instead of falling into a newbie-pattern ?

Thanks in advance

Sanjay

1 REPLY 1

Priyanka_Biswas
Databricks Employee
Databricks Employee

Hi @Sanjay_AMP 

Delta Live Tables and AutoLoader can be used together to incrementally ingest data from cloud object storage.
• Python code example:
 - Define a table called "customers" that reads data from a CSV file in cloud object storage.
 - Define a table called "sales_orders_raw" that reads data from a JSON file in cloud object storage.
• SQL code example:
 - Create or refresh a streaming table called "customers" that selects all data from a CSV file in cloud object storage.
 - Create or refresh a streaming table called "sales_orders_raw" that selects all data from a JSON file in cloud object storage.
• Options can be passed to the cloud_files() method using the map() function.
• Schema can be specified for formats that don't support schema inference.
• Additional code examples and documentation can be found at the provided sources.
@dlt.table
def customers():
  return (
    spark.readStream.format("cloudFiles")
      .option("cloudFiles.format", "csv")
      .load("/databricks-datasets/retail-org/customers/")
  )

@dlt.table
def sales_orders_raw():
  return (
    spark.readStream.format("cloudFiles")
      .option("cloudFiles.format", "json")
      .load("/databricks-datasets/retail-org/sales_orders/")
  )

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group