Skip to content

POST /deployments/impact returns 500 with unhandled psycopg IntegrityError when a node in the spec already exists #2309

Description

@shangyian

POST /deployments/impact returns HTTP 500 with an unhandled psycopg.errors.UniqueViolation on unique_node_namespace_name when the deployment spec contains a node that already exists. Impact analysis should reconcile an existing node as an update (or report it in the impact result), and a genuine conflict should surface as a typed DJAlreadyExistsException (409), not a raw DB error escaping as a 500.

Repro (v0.0.193):

  1. Create transform demo.scratch.foo.
  2. POST /deployments/impact with a spec that bulk-creates demo.scratch.foo plus another node.
  3. Server bulk-INSERTs into node, hits unique_node_namespace_name, and the IntegrityError propagates unhandled → 500.

Source: node-create path in datajunction_server/internal/deployment/orchestrator.py. A related unhandled TypeError occurs at datajunction_server/internal/deployment/orchestrator.py:1669 in _deploy_links on the same endpoint.

Fix: treat already-existing nodes as updates during impact/deploy, wrap node-create so a uniqueness conflict raises DJAlreadyExistsException (409) instead of leaking psycopg.IntegrityError, and guard the _deploy_links type error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions