View a markdown version of this page

Neptune 加载程序示例 - Amazon Neptune
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Neptune 加载程序示例

此示例演示如何使用 Neptune 加载程序使用 Gremlin CSV 格式将数据加载到 Neptune 图形数据库中。该请求作为 HTTP POST 请求发送到 Neptune 加载程序端点,请求正文包含指定数据来源、格式、IAM 角色和其他配置选项所需的参数。响应包括加载 ID,可用于跟踪数据加载过程的进度。

例请求

下面是使用 curl 命令经由 HTTP POST 发送的请求。它加载 Neptune CSV 格式的文件。有关更多信息,请参阅 Gremlin 加载数据格式

Amazon CLI
aws neptunedata start-loader-job \ --endpoint-url https://your-neptune-endpoint:port \ --source "s3://bucket-name/object-key-name" \ --format "csv" \ --iam-role-arn "ARN for the IAM role you are using" \ --s3-bucket-region "region" \ --no-fail-on-error \ --parallelism "MEDIUM" \ --no-update-single-cardinality-properties \ --no-queue-request

有关更多信息,请参阅《 Amazon CLI 命令参考》start-loader-job中的。

SDK
import boto3 from botocore.config import Config client = boto3.client( 'neptunedata', endpoint_url='https://your-neptune-endpoint:port', config=Config(read_timeout=None, retries={'total_max_attempts': 1}) ) response = client.start_loader_job( source='s3://bucket-name/object-key-name', format='csv', iamRoleArn='ARN for the IAM role you are using', s3BucketRegion='region', failOnError=False, parallelism='MEDIUM', updateSingleCardinalityProperties=False, queueRequest=False ) print(response)
awscurl
awscurl https://your-neptune-endpoint:port/loader \ --region us-east-1 \ --service neptune-db \ -X POST \ -H 'Content-Type: application/json' \ -d '{ "source" : "s3://bucket-name/object-key-name", "format" : "csv", "iamRoleArn" : "ARN for the IAM role you are using", "region" : "region", "failOnError" : "FALSE", "parallelism" : "MEDIUM", "updateSingleCardinalityProperties" : "FALSE", "queueRequest" : "FALSE" }'
注意

此示例假设您的 Amazon 证书是在您的环境中配置的。us-east-1替换为 Neptune 集群的区域。

curl
curl -X POST https://your-neptune-endpoint:port/loader \ -H 'Content-Type: application/json' \ -d '{ "source" : "s3://bucket-name/object-key-name", "format" : "csv", "iamRoleArn" : "ARN for the IAM role you are using", "region" : "region", "failOnError" : "FALSE", "parallelism" : "MEDIUM", "updateSingleCardinalityProperties" : "FALSE", "queueRequest" : "FALSE" }'
例响应
{ "status" : "200 OK", "payload" : { "loadId" : "ef478d76-d9da-4d94-8ff1-08d9d4863aa5" } }