Hello. I am trying to get a flow working that I believe was working at one point. However we figured out that there was an issue with there being a linked record in the artifact table. Has anyone ran into this or maybe knows the best way to handle it?
Here's some logs:
Error deleting flow run fff1e606-df85-484b-be6b-ccb13727bc35: Client error '409 Conflict' for url 'http://ephemeral-orion/api/flow_runs/fff1e606-df85-484b-be6b-ccb13727bc35'
For more information check: https://httpstatuses.com/409
I get one of these for each flow run I am trying to delete. I was able to use the query below in DBeaver to make the delete go through:
Copy code
WITH deleted_artifacts AS (
DELETE FROM artifact
WHERE flow_run_id = $1
RETURNING flow_run_id
)
DELETE FROM flow_run
WHERE id IN (SELECT DISTINCT flow_run_id FROM deleted_artifacts);
✅ 1
s
Serina
04/24/2023, 7:38 PM
Hi @Devin, what version of Prefect are you on?
d
Devin
04/24/2023, 7:58 PM
Hi @Serina We're using 2.7.12
s
Serina
04/24/2023, 8:08 PM
I have a feeling this is due to the fact that we introduced the artifact table in 2.7.11 where artifacts temporarily had a foreign key to flow run table. We removed that relationship in 2.8.0.
d
Devin
04/24/2023, 8:11 PM
Okay that makes sense. This may be a dumb question but is there a work around without upgrading?
s
Serina
04/24/2023, 8:33 PM
Like you mentioned, you could drop the constraint from the
artifact
table and I don’t think that should cause issues. However, I can’t say with certainty. If you truly can’t upgrade, I’d remove the constraint and you can add it back if you need to: https://github.com/PrefectHQ/prefect/pull/8457/files
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.