Skip to content

Commit 87b5d57

Browse files
committed
Fix defaults for v2 catalog endpoints
1 parent 2709d2c commit 87b5d57

12 files changed

+126
-143
lines changed

graphdatascience/procedure_surface/api/catalog/graph_sampling_endpoints.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ def rwr(
2020
G: GraphV2,
2121
graph_name: str,
2222
start_nodes: list[int] | None = None,
23-
restart_probability: float | None = None,
24-
sampling_ratio: float | None = None,
25-
node_label_stratification: bool | None = None,
23+
restart_probability: float = 0.1,
24+
sampling_ratio: float = 0.15,
25+
node_label_stratification: bool = False,
2626
relationship_weight_property: str | None = None,
2727
relationship_types: list[str] = ALL_TYPES,
2828
node_labels: list[str] = ALL_LABELS,
29-
sudo: bool | None = None,
29+
sudo: bool = False,
3030
log_progress: bool = True,
3131
username: str | None = None,
3232
concurrency: int | None = None,
@@ -93,13 +93,13 @@ def cnarw(
9393
G: GraphV2,
9494
graph_name: str,
9595
start_nodes: list[int] | None = None,
96-
restart_probability: float | None = None,
97-
sampling_ratio: float | None = None,
98-
node_label_stratification: bool | None = None,
96+
restart_probability: float = 0.1,
97+
sampling_ratio: float = 0.15,
98+
node_label_stratification: bool = False,
9999
relationship_weight_property: str | None = None,
100100
relationship_types: list[str] = ALL_TYPES,
101101
node_labels: list[str] = ALL_LABELS,
102-
sudo: bool | None = None,
102+
sudo: bool = False,
103103
log_progress: bool = True,
104104
username: str | None = None,
105105
concurrency: int | None = None,

graphdatascience/procedure_surface/api/catalog/node_label_endpoints.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
from abc import ABC, abstractmethod
4-
from typing import Any
54

65
from graphdatascience.procedure_surface.api.base_result import BaseResult
76
from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2
@@ -39,11 +38,11 @@ def mutate(
3938
Whether to log progress
4039
username : str | None, default=None
4140
The username to attribute the procedure run to
42-
concurrency : Any | None, default=None
41+
concurrency : int | None, default=None
4342
The number of concurrent threads
44-
write_concurrency : Any | None, default=None
43+
write_concurrency : int | None, default=None
4544
The number of concurrent threads used for the mutation
46-
job_id : Any | None, default=None
45+
job_id : str | None, default=None
4746
An identifier for the job
4847
Returns
4948
-------
@@ -62,9 +61,9 @@ def write(
6261
sudo: bool | None = None,
6362
log_progress: bool = True,
6463
username: str | None = None,
65-
concurrency: Any | None = None,
66-
write_concurrency: Any | None = None,
67-
job_id: Any | None = None,
64+
concurrency: int | None = None,
65+
write_concurrency: int | None = None,
66+
job_id: str | None = None,
6867
) -> NodeLabelWriteResult:
6968
"""
7069
Writes the specified node label to the filtered nodes in the database.

graphdatascience/procedure_surface/api/catalog/node_properties_endpoints.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def stream(
2020
*,
2121
list_node_labels: bool | None = None,
2222
node_labels: list[str] = ALL_LABELS,
23-
concurrency: Any | None = None,
24-
sudo: bool | None = None,
23+
concurrency: int | None = None,
24+
sudo: bool = False,
2525
log_progress: bool = True,
2626
username: str | None = None,
27-
job_id: Any | None = None,
27+
job_id: str | None = None,
2828
db_node_properties: list[str] | None = None,
2929
) -> DataFrame:
3030
"""
@@ -66,12 +66,12 @@ def write(
6666
node_properties: str | list[str] | dict[str, str],
6767
*,
6868
node_labels: list[str] = ALL_LABELS,
69-
concurrency: Any | None = None,
70-
write_concurrency: Any | None = None,
71-
sudo: bool | None = None,
69+
concurrency: int | None = None,
70+
write_concurrency: int | None = None,
71+
sudo: bool = False,
7272
log_progress: bool = True,
7373
username: str | None = None,
74-
job_id: Any | None = None,
74+
job_id: str | None = None,
7575
) -> NodePropertiesWriteResult:
7676
"""
7777
Writes the specified node properties from the graph to the database.
@@ -111,7 +111,7 @@ def drop(
111111
node_properties: list[str],
112112
*,
113113
fail_if_missing: bool | None = None,
114-
concurrency: Any | None = None,
114+
concurrency: int | None = None,
115115
username: str | None = None,
116116
) -> NodePropertiesDropResult:
117117
"""
@@ -125,7 +125,7 @@ def drop(
125125
The node properties to drop
126126
fail_if_missing: bool | None = None,
127127
Whether to fail if any of the node properties are missing
128-
concurrency : Any | None, default=None
128+
concurrency : int | None = None
129129
The number of concurrent threads
130130
username : str | None, default=None
131131
The username to attribute the procedure run to

graphdatascience/procedure_surface/api/catalog/relationships_endpoints.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def stream(
2020
relationship_types: list[str] = ALL_TYPES,
2121
relationship_properties: list[str] | None = None,
2222
*,
23-
concurrency: Any | None = None,
24-
sudo: bool | None = None,
23+
concurrency: int | None = None,
24+
sudo: bool = False,
2525
log_progress: bool = True,
2626
username: str | None = None,
2727
) -> DataFrame:
@@ -37,11 +37,11 @@ def stream(
3737
If not specified, all relationships in the graph will be streamed.
3838
relationship_properties: list[str] | None, default = None
3939
The relationship properties to stream. If not specified, no properties will be streamed.
40-
concurrency : Any | None, default=None
40+
concurrency : int | None, default=None
4141
The number of concurrent threads
4242
sudo : bool
4343
Override memory estimation limits
44-
log_progress : bool | None, default=None
44+
log_progress : bool = True
4545
Whether to log progress
4646
username : str | None, default=None
4747
The username to attribute the procedure run to
@@ -59,12 +59,12 @@ def write(
5959
relationship_type: str,
6060
relationship_properties: list[str] | None = None,
6161
*,
62-
concurrency: Any | None = None,
63-
write_concurrency: Any | None = None,
64-
sudo: bool | None = None,
62+
concurrency: int | None = None,
63+
write_concurrency: int | None = None,
64+
sudo: bool = False,
6565
log_progress: bool = True,
6666
username: str | None = None,
67-
job_id: Any | None = None,
67+
job_id: str | None = None,
6868
) -> RelationshipsWriteResult:
6969
"""
7070
Writes all relationships of the specified relationship type with the specified properties from the graph to the database.
@@ -77,17 +77,17 @@ def write(
7777
The relationship type to write to the database
7878
relationship_properties: list[str] | None, default = None
7979
The relationship properties to write. If not specified, no properties will be written.
80-
concurrency : Any | None, default=None
80+
concurrency : int | None, default=None
8181
The number of concurrent threads
82-
write_concurrency : Any | None, default=None
82+
write_concurrency : int | None, default=None
8383
The number of concurrent threads used for writing
8484
sudo : bool
8585
Override memory estimation limits
8686
log_progress : bool | None, default=None
8787
Whether to log progress
8888
username : str | None, default=None
8989
The username to attribute the procedure run to
90-
job_id : Any | None, default=None
90+
job_id : str | None, default=None
9191
An identifier for the job
9292
Returns
9393
-------
@@ -128,11 +128,11 @@ def index_inverse(
128128
G: GraphV2,
129129
relationship_types: list[str],
130130
*,
131-
concurrency: Any | None = None,
132-
sudo: bool | None = None,
131+
concurrency: int | None = None,
132+
sudo: bool = False,
133133
log_progress: bool = True,
134134
username: str | None = None,
135-
job_id: Any | None = None,
135+
job_id: str | None = None,
136136
) -> RelationshipsInverseIndexResult:
137137
"""
138138
Creates an index of the specified relationships indexing the reverse direction of each relationship.
@@ -144,15 +144,15 @@ def index_inverse(
144144
The graph to operate on
145145
relationship_types: list[str] = ALL_TYPES,
146146
The relationship types to create the inverse index for
147-
concurrency : Any | None, default=None
147+
concurrency : int | None, default=None
148148
The number of concurrent threads
149-
sudo : bool
149+
sudo : bool = False,
150150
Override memory estimation limits
151-
log_progress : bool | None, default=None
151+
log_progress : bool = True
152152
Whether to log progress
153153
username : str | None, default=None
154154
The username to attribute the procedure run to
155-
job_id : Any | None, default=None
155+
job_id : str | None, default=None
156156
An identifier for the job
157157
Returns
158158
-------
@@ -168,11 +168,11 @@ def to_undirected(
168168
mutate_relationship_type: str,
169169
*,
170170
aggregation: Aggregation | dict[str, Aggregation] | None = None,
171-
concurrency: Any | None = None,
172-
sudo: bool | None = None,
171+
concurrency: int | None = None,
172+
sudo: bool = False,
173173
log_progress: bool = True,
174174
username: str | None = None,
175-
job_id: Any | None = None,
175+
job_id: str | None = None,
176176
) -> RelationshipsToUndirectedResult:
177177
"""
178178
Creates a new relationship type in the graph.
@@ -190,15 +190,15 @@ def to_undirected(
190190
Specifies how to aggregate parallel relationships in the graph.
191191
If a single aggregation is provided, it will be used for properties of the specified relationships.
192192
A dictionary can be provided to specify property specific aggregations.
193-
concurrency : Any | None, default=None
193+
concurrency : int | None, default=None
194194
The number of concurrent threads
195-
sudo : bool
195+
sudo : bool = False,
196196
Override memory estimation limits
197-
log_progress : bool | None, default=None
197+
log_progress : bool = True
198198
Whether to log progress
199199
username : str | None, default=None
200200
The username to attribute the procedure run to
201-
job_id : Any | None, default=None
201+
job_id : str | None, default=None
202202
An identifier for the job
203203
Returns
204204
-------

graphdatascience/procedure_surface/arrow/catalog/graph_sampling_arrow_endpoints.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from __future__ import annotations
22

3-
from typing import Any
4-
53
from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
64
from graphdatascience.arrow_client.v2.job_client import JobClient
75
from graphdatascience.procedure_surface.api.catalog.graph_api import GraphV2
@@ -25,17 +23,17 @@ def rwr(
2523
G: GraphV2,
2624
graph_name: str,
2725
start_nodes: list[int] | None = None,
28-
restart_probability: float | None = None,
29-
sampling_ratio: float | None = None,
30-
node_label_stratification: bool | None = None,
26+
restart_probability: float = 0.1,
27+
sampling_ratio: float = 0.15,
28+
node_label_stratification: bool = False,
3129
relationship_weight_property: str | None = None,
3230
relationship_types: list[str] = ALL_TYPES,
3331
node_labels: list[str] = ALL_LABELS,
34-
sudo: bool | None = None,
32+
sudo: bool = False,
3533
log_progress: bool = True,
3634
username: str | None = None,
37-
concurrency: Any | None = None,
38-
job_id: Any | None = None,
35+
concurrency: int | None = None,
36+
job_id: str | None = None,
3937
) -> GraphWithSamplingResult:
4038
config = ConfigConverter.convert_to_gds_config(
4139
from_graph_name=G.name(),
@@ -69,17 +67,17 @@ def cnarw(
6967
G: GraphV2,
7068
graph_name: str,
7169
start_nodes: list[int] | None = None,
72-
restart_probability: float | None = None,
73-
sampling_ratio: float | None = None,
74-
node_label_stratification: bool | None = None,
70+
restart_probability: float = 0.1,
71+
sampling_ratio: float = 0.15,
72+
node_label_stratification: bool = False,
7573
relationship_weight_property: str | None = None,
7674
relationship_types: list[str] = ALL_TYPES,
7775
node_labels: list[str] = ALL_LABELS,
78-
sudo: bool | None = None,
76+
sudo: bool = False,
7977
log_progress: bool = True,
8078
username: str | None = None,
81-
concurrency: Any | None = None,
82-
job_id: Any | None = None,
79+
concurrency: int | None = None,
80+
job_id: str | None = None,
8381
) -> GraphWithSamplingResult:
8482
config = ConfigConverter.convert_to_gds_config(
8583
from_graph_name=G.name(),

graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any
2-
31
from graphdatascience.arrow_client.authenticated_flight_client import AuthenticatedArrowClient
42
from graphdatascience.arrow_client.v2.job_client import JobClient
53
from graphdatascience.arrow_client.v2.remote_write_back_client import RemoteWriteBackClient
@@ -36,9 +34,9 @@ def mutate(
3634
sudo: bool | None = None,
3735
log_progress: bool = True,
3836
username: str | None = None,
39-
concurrency: Any | None = None,
40-
write_concurrency: Any | None = None,
41-
job_id: Any | None = None,
37+
concurrency: int | None = None,
38+
write_concurrency: int | None = None,
39+
job_id: str | None = None,
4240
) -> NodeLabelMutateResult:
4341
config = ConfigConverter.convert_to_gds_config(
4442
graph_name=G.name(),
@@ -67,9 +65,9 @@ def write(
6765
sudo: bool | None = None,
6866
log_progress: bool = True,
6967
username: str | None = None,
70-
concurrency: Any | None = None,
71-
write_concurrency: Any | None = None,
72-
job_id: Any | None = None,
68+
concurrency: int | None = None,
69+
write_concurrency: int | None = None,
70+
job_id: str | None = None,
7371
) -> NodeLabelWriteResult:
7472
config = ConfigConverter.convert_to_gds_config(
7573
graph_name=G.name(),

graphdatascience/procedure_surface/arrow/catalog/node_properties_arrow_endpoints.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from typing import Any
2-
31
from pandas import DataFrame
42

53
from graphdatascience import QueryRunner
@@ -44,11 +42,11 @@ def stream(
4442
*,
4543
list_node_labels: bool | None = None,
4644
node_labels: list[str] = ALL_LABELS,
47-
concurrency: Any | None = None,
48-
sudo: bool | None = None,
45+
concurrency: int | None = None,
46+
sudo: bool = False,
4947
log_progress: bool = True,
5048
username: str | None = None,
51-
job_id: Any | None = None,
49+
job_id: str | None = None,
5250
db_node_properties: list[str] | None = None,
5351
) -> DataFrame:
5452
has_db_properties = (db_node_properties is not None) and (len(db_node_properties) > 0)
@@ -84,12 +82,12 @@ def write(
8482
node_properties: str | list[str] | dict[str, str],
8583
*,
8684
node_labels: list[str] = ALL_LABELS,
87-
concurrency: Any | None = None,
88-
write_concurrency: Any | None = None,
89-
sudo: bool | None = None,
85+
concurrency: int | None = None,
86+
write_concurrency: int | None = None,
87+
sudo: bool = False,
9088
log_progress: bool = True,
9189
username: str | None = None,
92-
job_id: Any | None = None,
90+
job_id: str | None = None,
9391
) -> NodePropertiesWriteResult:
9492
if self._write_back_client is None:
9593
raise ValueError("Write back is only available if a database connection is provided.")
@@ -131,7 +129,7 @@ def drop(
131129
node_properties: list[str],
132130
*,
133131
fail_if_missing: bool | None = None,
134-
concurrency: Any | None = None,
132+
concurrency: int | None = None,
135133
username: str | None = None,
136134
) -> NodePropertiesDropResult:
137135
config = ConfigConverter.convert_to_gds_config(

0 commit comments

Comments
 (0)