Skip to content

Commit

Permalink
Merge pull request #2034 from opsmill/dga-20240125-revert-2002
Browse files Browse the repository at this point in the history
Revert "set id in _generate_input_data"
  • Loading branch information
dgarros authored Jan 25, 2024
2 parents 2f06e9d + b272db9 commit 09ce0cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python_sdk/infrahub_sdk/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,6 @@ def _generate_input_data(self, exclude_unmodified: bool = False) -> Dict[str, Di
# pylint: disable=too-many-branches
data = {}
variables = {}
if self.id is not None:
data["id"] = self.id
for item_name in self._attributes:
attr: Attribute = getattr(self, item_name)
if attr._schema.read_only:
Expand Down Expand Up @@ -1185,6 +1183,7 @@ async def generate_query_data_node(

async def create(self, at: Timestamp, allow_upsert: bool = False) -> None:
input_data = self._generate_input_data()
input_data["data"]["data"]["id"] = self.id
mutation_query = {"ok": None, "object": {"id": None}}
if allow_upsert:
mutation_name = f"{self._schema.kind}Upsert"
Expand Down Expand Up @@ -1213,6 +1212,7 @@ async def create(self, at: Timestamp, allow_upsert: bool = False) -> None:

async def update(self, at: Timestamp, do_full_update: bool = False) -> None:
input_data = self._generate_input_data(exclude_unmodified=not do_full_update)
input_data["data"]["data"]["id"] = self.id
mutation_query = {"ok": None, "object": {"id": None}}
query = Mutation(
mutation=f"{self._schema.kind}Update",
Expand Down Expand Up @@ -1495,6 +1495,7 @@ def generate_query_data_node(

def create(self, at: Timestamp, allow_upsert: bool = False) -> None:
input_data = self._generate_input_data()
input_data["data"]["data"]["id"] = self.id
mutation_query = {"ok": None, "object": {"id": None}}
if allow_upsert:
mutation_name = f"{self._schema.kind}Upsert"
Expand Down Expand Up @@ -1524,6 +1525,7 @@ def create(self, at: Timestamp, allow_upsert: bool = False) -> None:

def update(self, at: Timestamp, do_full_update: bool = False) -> None:
input_data = self._generate_input_data(exclude_unmodified=not do_full_update)
input_data["data"]["data"]["id"] = self.id
mutation_query = {"ok": None, "object": {"id": None}}
query = Mutation(
mutation=f"{self._schema.kind}Update",
Expand Down

0 comments on commit 09ce0cd

Please sign in to comment.