https://kedro.org/ logo
#questions
Title
# questions
p

Priyanka Patil

10/26/2023, 6:57 PM
Hello Kedro team, I have a last minute requirement - need to update a table in the kedro pipeline. I’m using the sql query dataset to specify the update sql query. I have a pipeline as follows:
Copy code
def create_pipeline(**kwargs) -> Pipeline:
    """
    """
    return pipeline(
        [
            node(
                func=lambda *args: None,
                inputs=["<catalog entry for the update query>"],
                outputs=None,
                name="update_table",
            ),
        ]
    )
This executes the update query successfully, but the pipeline fails because there are no results to be returned. Is there a workaround for this? Thank you so much!
j

Juan Luis

10/27/2023, 8:39 AM
hello @Priyanka Patil, can you share the traceback? in principle
outputs=None
should be OK, unless I'm missing something
p

Priyanka Patil

11/01/2023, 6:10 PM
sure thing! @Juan Luis here’s the error trace..
Copy code
sqlalchemy.exc.ResourceClosedError: This result object does not return rows. It has been closed automatically.
Copy code
kedro.io.core.DataSetError: Failed while loading data from data set SQLQueryDataSet(execution_options={}, filepath=None, load_args={}, sql=update tablename set status = 'COMPLETE' where id = 22;).
This result object does not return rows. It has been closed automatically.
this post can be closed Here’s the fix:
Copy code
update tablename set status = 'COMPLETE' where id = 22 RETURNING tablename.*;
j

Juan Luis

11/01/2023, 8:03 PM
glad you solved it!
👌 1