graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

Derive Upsert Commands

Open olmohake opened this issue 10 months ago • 2 comments

Component

v3-engine v3-ndc-postgres

Is your proposal related to a problem?

v2 was supporting upserts via

mutation upsert_article {
  insert_article (
    objects: [
      {
        id: 1
        title: "First Article",
        content: "Updated article 1 content",
        published_on: "2018-10-12"
      }
    ],
    on_conflict: {
      constraint: article_title_key,
      update_columns: [content]
    }
  ) {
    returning {
      id
      title
      content
      published_on
    }
  }
} 

this has not been implemented in v3 so far.

Describe the solution you'd like

derive a dedicated upsert command for all persisted models.

mutation upsert_article {
  upsertArticle (
    objects: [
      {
        id: 1
        title: "First Article",
        content: "Updated article 1 content",
        published_on: "2018-10-12"
      }
    ],
     update_columns: [content]
    }
  ) {
    returning {
      id
      title
      content
      published_on
    }
  }
} 

Describe alternatives you've considered

Implement upsert commands via native operations.

olmohake avatar Jan 17 '25 21:01 olmohake

I am checking with the team for an update on upserts for the Postgres connector.

seanparkross avatar Jan 20 '25 12:01 seanparkross

Any updates?

WichardRiezebos avatar Apr 28 '25 16:04 WichardRiezebos