Skip to content

Commit 517149c

Browse files
committed
Merge branch 'kgs/update-source'
2 parents d844dc3 + 627eb38 commit 517149c

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

datatorch/api/entity/sources/source.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,21 @@
2323
}
2424
"""
2525

26+
_UPDATE_SOURCE = """
27+
mutation UpdateSource(
28+
$id: ID!
29+
$type: String!
30+
$data: JSON!
31+
) {
32+
source: updateSource(
33+
id: $id
34+
type: $type
35+
data: $data
36+
) {
37+
id
38+
}
39+
}
40+
"""
2641

2742
class Source(BaseEntity):
2843

@@ -56,3 +71,16 @@ def create(self, client=None):
5671
)
5772
r_source = results.get("source")
5873
self.id = r_source.get("id")
74+
75+
def save(self, client=None):
76+
super().save(client=client)
77+
78+
assert self.type is not None, "Source must have a type"
79+
self.client.execute(
80+
_UPDATE_SOURCE,
81+
params={
82+
"id": self.id,
83+
"type": self.type,
84+
"data": self.data(),
85+
},
86+
)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
setup(
2626
name="datatorch",
27-
version="0.4.0",
27+
version="0.4.1",
2828
description="A CLI and library for interacting with DataTorch",
2929
author="DataTorch",
3030
author_email="support@datatorch.io",

0 commit comments

Comments
 (0)