Skip to content

Support edgeOnlyLoad param for load magic #750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions src/graph_notebook/magics/graph_magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2095,6 +2095,8 @@ def load(self, line='', local_ns: dict = None):
parser.add_argument('--allow-empty-strings', action='store_true', default=False,
help='Load empty strings found in node and edge property values.')
parser.add_argument('-n', '--nopoll', action='store_true', default=False)
parser.add_argument('--edge-only-load', action='store_true', default=False,
help='Assume there are only edge files present - do not scan for vertex files before loading edge files.')

args = parser.parse_args(line.split())
button = widgets.Button(description="Submit")
Expand Down Expand Up @@ -2238,6 +2240,13 @@ def load(self, line='', local_ns: dict = None):
disabled=False,
layout=widgets.Layout(width=widget_width)
)

edge_only_load = widgets.Dropdown(
options=['TRUE', 'FALSE'],
value=str(args.edge_only_load).upper(),
disabled=False,
layout=widgets.Layout(width=widget_width)
)

# Create a series of HBox containers that will hold the widgets and labels
# that make up the %load form. Some of the labels and widgets are created
Expand Down Expand Up @@ -2347,6 +2356,13 @@ def load(self, line='', local_ns: dict = None):
justify_content="flex-end"))

poll_status_hbox = widgets.HBox([poll_status_label, poll_status])

edge_only_load_label = widgets.Label('Edge Only load:',
layout=widgets.Layout(width=label_width,
display="flex",
justify_content="flex-end"))

edge_only_load_hbox = widgets.HBox([edge_only_load_label, edge_only_load])

def update_edge_ids_options(change):
if change.new.lower() == FORMAT_OPENCYPHER:
Expand Down Expand Up @@ -2399,7 +2415,7 @@ def update_parserconfig_options(change):
# load arguments for Neptune bulk load
bulk_load_boxes = [arn_hbox, mode_hbox, parallelism_hbox, cardinality_hbox,
queue_hbox, dep_hbox, ids_hbox, allow_empty_strings_hbox,
named_graph_uri_hbox, base_uri_hbox, poll_status_hbox]
named_graph_uri_hbox, base_uri_hbox, poll_status_hbox, edge_only_load_hbox]
submit_load_boxes = [button, output]

if load_type == 'incremental':
Expand All @@ -2418,6 +2434,7 @@ def on_button_clicked(b):
base_uri_hbox.children = (base_uri_hbox_label, base_uri,)
dep_hbox.children = (dep_hbox_label, dependencies,)
concurrency_hbox.children = (concurrency_hbox_label, concurrency,)
edge_only_load_hbox.children = (edge_only_load_label, edge_only_load,)

validated = True
validation_label_style = DescriptionStyle(color='red')
Expand Down Expand Up @@ -2473,7 +2490,8 @@ def on_button_clicked(b):
'parallelism': parallelism.value,
'updateSingleCardinalityProperties': update_single_cardinality.value,
'queueRequest': queue_request.value,
'parserConfiguration': {}
'parserConfiguration': {},
'edgeOnlyLoad': edge_only_load.value
}

if dependencies:
Expand Down Expand Up @@ -2508,6 +2526,7 @@ def on_button_clicked(b):
named_graph_uri_hbox.close()
base_uri_hbox.close()
concurrency_hbox.close()
edge_only_load_hbox.close()
button.close()

load_submit_status_output = widgets.Output()
Expand Down