diff --git a/_questions/data-engineering-zoomcamp/general/058_e08b9c753f_pyflink-sess-window-pk-fix.md b/_questions/data-engineering-zoomcamp/general/058_e08b9c753f_pyflink-sess-window-pk-fix.md new file mode 100644 index 0000000..3e9c919 --- /dev/null +++ b/_questions/data-engineering-zoomcamp/general/058_e08b9c753f_pyflink-sess-window-pk-fix.md @@ -0,0 +1,8 @@ +--- +id: e08b9c753f +question: PyFlink session window job fails with 'please declare primary key for sink + table when query contains update/delete record' error +sort_order: 58 +--- + +Session window aggregations produce updates while the session is still open. The JDBC sink needs a primary key so it knows which row should be updated in the table. Without a primary key, Flink cannot apply the updates and the job fails. Define a primary key in the sink table using the window boundaries and the grouping key (for example window_start, window_end, and PULocationID). \ No newline at end of file