Alberto_Umana
Databricks Employee
Databricks Employee

Hi @aliacovella,

The error message you received indicates that no tables are defined by the libraries of the pipeline, which typically occurs when all top-level definitions are views.

 

In Delta Live Tables, a pipeline must include at least one table definition. Views alone are not sufficient to define a pipeline. This is because views in DLT are meant to be derived from tables, and the pipeline needs at least one table to anchor the transformations.

 

To resolve this issue, you can define a table in your pipeline alongside your views. Here is an example of how you can modify your pipeline to include a table definition:

 

import dlt

from pyspark.sql.functions import *

 

# Define a table

@dlt.table

def users_table():

    return spark.read.table("some_catalog.public.users")

 

# Define a view based on the table

@dlt.view

def users_view():

    return dlt.read("users_table")

 

In this example, users_table is defined as a table, and users_view is a view that references the users_table. This ensures that your pipeline has at least one table definition, which should resolve the error you encountered.