MCPcopy Create free account
hub / github.com/alibaba/GraphScope / bind_datasource_in_batch

Function bind_datasource_in_batch

python/graphscope/gsctl/impl/datasource.py:28–46  ·  view source on GitHub ↗
(graph_identifier: str, datasource: dict)

Source from the content-addressed store, hash-verified

26
27
28def bind_datasource_in_batch(graph_identifier: str, datasource: dict) -> str:
29 # upload files
30 for mapping in itertools.chain(
31 datasource["vertex_mappings"], datasource["edge_mappings"]
32 ):
33 for index, location in enumerate(mapping["inputs"]):
34 # path begin with "@" represents the local file
35 if location.startswith("@"):
36 location = location[1:]
37 mapping["inputs"][index] = upload_file(location)
38 # bind data source
39 context = get_current_context()
40 with graphscope.flex.rest.ApiClient(
41 graphscope.flex.rest.Configuration(context.coordinator_endpoint)
42 ) as api_client:
43 api_instance = graphscope.flex.rest.DataSourceApi(api_client)
44 return api_instance.bind_datasource_in_batch(
45 graph_identifier, SchemaMapping.from_dict(datasource)
46 )
47
48
49def get_datasource_by_id(graph_identifier: str) -> SchemaMapping:

Callers 4

datasourceFunction · 0.90
datasourceFunction · 0.90
test_dataloadingMethod · 0.90
test_bulk_loadingMethod · 0.90

Calls 5

upload_fileFunction · 0.90
get_current_contextFunction · 0.90
ConfigurationMethod · 0.45
from_dictMethod · 0.45

Tested by 2

test_dataloadingMethod · 0.72
test_bulk_loadingMethod · 0.72