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:ย 

Pipelines are expected to have at least one table Error While running DLT pipeline

vignesh22
New Contributor

Error :Pipelines are expected to have at least one table defined but

no tables were found in your pipeline

 

I wrote simple code as phase 1 debug
%sql CREATE OR REFRESH STREAMING TABLE test_table AS SELECT "hello" as greeting;

 

Can u plz help what's wrong in this code ?

Pricing Tier : Premium (+ Role-based access controls) (Click to change)

2 REPLIES 2

Takuya-Omi
Valued Contributor III

@vignesh22 

In Delta Live Tables (DLT), magic commands (such as %sql) are not used. In a DLT pipeline, you need to write SQL code directly. Please try removing %sql and running the DLT pipeline again.

--------------------------
Takuya Omi (ๅฐพ็พŽๆ‹“ๅ“‰)

aayrm5
Honored Contributor

Hey @vignesh22 - Adding to what @Takuya-Omi san has mentioned - the instantiation of streaming table in your definition is incorrect. You're trying to create a stream table using a batch source which will result in the DLT Analysis Exception as described below.

com.databricks.pipelines.common.errors.DLTAnalysisException: Creating a streaming table from a batch query prevents incremental loading of new data from source. Offending table: 'dev.default.test_table'.
Please use the stream() operator. Example usage:
CREATE STREAMING TABLE <target table name> ... AS SELECT ... FROM stream(<source table name>) ...

If you're only trying to test the functionality of DLT, may be create a materialized view rather than the streaming table.

https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-materialized-view 

Let me know if any questions! Cheers!

 

Riz

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local communityโ€”sign up today to get started!

Sign Up Now