susanne
Databricks Partner

For me the problem was solved when I defined the schema in dlt as following:

@Dlt.table(
name=f"{target_table}",        
schema = """userid STRING,                    
                    contract_no INT,
                   CONSTRAINT pk_<table_name> PRIMARY KEY(userid)""",    
)


instead of using this:

schema = """userid STRING PRIMARY KEY,                    
                    contract_no INT"""