Skip to content

Commit

Permalink
Revert "set id in _generate_input_data"
Browse files Browse the repository at this point in the history
This reverts commit 353376b.
  • Loading branch information
dgarros committed Jan 25, 2024
1 parent b1912a8 commit b272db9
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 @@ -1187,6 +1185,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 @@ -1215,6 +1214,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 @@ -1497,6 +1497,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 @@ -1526,6 +1527,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 b272db9

Please sign in to comment.