Hello. I am trying to get a flow working that I be...
# prefect-community
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);
Hi @Devin, what version of Prefect are you on?
Hi @Serina We're using 2.7.12
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.
Okay that makes sense. This may be a dumb question but is there a work around without upgrading?
Like you mentioned, you could drop the constraint from the
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
Awesome thanks for the advice!
🙌 1