Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 74b08e4

Browse files
Python Add the Amazon Neptune Python follow (#7473)
* add python neptune follow
1 parent 99ecc7b commit 74b08e4

32 files changed

+2882
-45
lines changed

‎.doc_gen/metadata/neptune_metadata.yaml‎

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ neptune_Hello:
55
synopsis: get started using &neptune;.
66
category: Hello
77
languages:
8+
Python:
9+
versions:
10+
- sdk_version: 3
11+
github: python/example_code/neptune
12+
excerpts:
13+
- description:
14+
snippet_tags:
15+
- neptune.python.hello.main
816
Java:
917
versions:
1018
- sdk_version: 2
@@ -18,6 +26,14 @@ neptune_Hello:
1826
neptune: {DescribeDBClustersPaginator}
1927
neptune_ExecuteQuery:
2028
languages:
29+
Python:
30+
versions:
31+
- sdk_version: 3
32+
github: python/example_code/neptune
33+
excerpts:
34+
- description:
35+
snippet_tags:
36+
- neptune.python.graph.execute.main
2137
Java:
2238
versions:
2339
- sdk_version: 2
@@ -31,6 +47,14 @@ neptune_ExecuteQuery:
3147
neptune: {ExecuteQuery}
3248
neptune_CreateGraph:
3349
languages:
50+
Python:
51+
versions:
52+
- sdk_version: 3
53+
github: python/example_code/neptune
54+
excerpts:
55+
- description:
56+
snippet_tags:
57+
- neptune.python.graph.create.main
3458
Java:
3559
versions:
3660
- sdk_version: 2
@@ -44,6 +68,14 @@ neptune_CreateGraph:
4468
neptune: {CreateGraph}
4569
neptune_ExecuteOpenCypherExplainQuery:
4670
languages:
71+
Python:
72+
versions:
73+
- sdk_version: 3
74+
github: python/example_code/neptune
75+
excerpts:
76+
- description:
77+
snippet_tags:
78+
- neptune.python.data.query.opencypher.main
4779
Java:
4880
versions:
4981
- sdk_version: 2
@@ -57,6 +89,14 @@ neptune_ExecuteOpenCypherExplainQuery:
5789
neptune: {ExecuteOpenCypherExplainQuery}
5890
neptune_ExecuteGremlinProfileQuery:
5991
languages:
92+
Python:
93+
versions:
94+
- sdk_version: 3
95+
github: python/example_code/neptune
96+
excerpts:
97+
- description:
98+
snippet_tags:
99+
- neptune.python.data.query.gremlin.main
60100
Java:
61101
versions:
62102
- sdk_version: 2
@@ -70,6 +110,14 @@ neptune_ExecuteGremlinProfileQuery:
70110
neptune: {ExecuteGremlinProfileQuery}
71111
neptune_ExecuteGremlinQuery:
72112
languages:
113+
Python:
114+
versions:
115+
- sdk_version: 3
116+
github: python/example_code/neptune
117+
excerpts:
118+
- description:
119+
snippet_tags:
120+
- neptune.python.data.query.gremlin.profile.main
73121
Java:
74122
versions:
75123
- sdk_version: 2
@@ -83,6 +131,14 @@ neptune_ExecuteGremlinQuery:
83131
neptune: {ExecuteGremlinQuery}
84132
neptune_DeleteDBSubnetGroup:
85133
languages:
134+
Python:
135+
versions:
136+
- sdk_version: 3
137+
github: python/example_code/neptune
138+
excerpts:
139+
- description:
140+
snippet_tags:
141+
- neptune.python.delete.subnet.group.main
86142
Java:
87143
versions:
88144
- sdk_version: 2
@@ -96,6 +152,14 @@ neptune_DeleteDBSubnetGroup:
96152
neptune: {DeleteDBSubnetGroup}
97153
neptune_DeleteDBCluster:
98154
languages:
155+
Python:
156+
versions:
157+
- sdk_version: 3
158+
github: python/example_code/neptune
159+
excerpts:
160+
- description:
161+
snippet_tags:
162+
- neptune.python.delete.cluster.main
99163
Java:
100164
versions:
101165
- sdk_version: 2
@@ -109,6 +173,14 @@ neptune_DeleteDBCluster:
109173
neptune: {DeleteDBCluster}
110174
neptune_DeleteDBInstance:
111175
languages:
176+
Python:
177+
versions:
178+
- sdk_version: 3
179+
github: python/example_code/neptune
180+
excerpts:
181+
- description:
182+
snippet_tags:
183+
- neptune.python.delete.instance.main
112184
Java:
113185
versions:
114186
- sdk_version: 2
@@ -122,6 +194,14 @@ neptune_DeleteDBInstance:
122194
neptune: {DeleteDBInstance}
123195
neptune_StartDBCluster:
124196
languages:
197+
Python:
198+
versions:
199+
- sdk_version: 3
200+
github: python/example_code/neptune
201+
excerpts:
202+
- description:
203+
snippet_tags:
204+
- neptune.python.start.cluster.main
125205
Java:
126206
versions:
127207
- sdk_version: 2
@@ -135,6 +215,14 @@ neptune_StartDBCluster:
135215
neptune: {StartDBCluster}
136216
neptune_StopDBCluster:
137217
languages:
218+
Python:
219+
versions:
220+
- sdk_version: 3
221+
github: python/example_code/neptune
222+
excerpts:
223+
- description:
224+
snippet_tags:
225+
- neptune.python.stop.cluster.main
138226
Java:
139227
versions:
140228
- sdk_version: 2
@@ -148,6 +236,14 @@ neptune_StopDBCluster:
148236
neptune: {StopDBCluster}
149237
neptune_DescribeDBClusters:
150238
languages:
239+
Python:
240+
versions:
241+
- sdk_version: 3
242+
github: python/example_code/neptune
243+
excerpts:
244+
- description:
245+
snippet_tags:
246+
- neptune.python.describe.cluster.main
151247
Java:
152248
versions:
153249
- sdk_version: 2
@@ -161,6 +257,14 @@ neptune_DescribeDBClusters:
161257
neptune: {DescribeDBClusters}
162258
neptune_DescribeDBInstances:
163259
languages:
260+
Python:
261+
versions:
262+
- sdk_version: 3
263+
github: python/example_code/neptune
264+
excerpts:
265+
- description:
266+
snippet_tags:
267+
- neptune.python.describe.dbinstance.main
164268
Java:
165269
versions:
166270
- sdk_version: 2
@@ -174,6 +278,14 @@ neptune_DescribeDBInstances:
174278
neptune: {DescribeDBInstances}
175279
neptune_CreateDBInstance:
176280
languages:
281+
Python:
282+
versions:
283+
- sdk_version: 3
284+
github: python/example_code/neptune
285+
excerpts:
286+
- description:
287+
snippet_tags:
288+
- neptune.python.create.dbinstance.main
177289
Java:
178290
versions:
179291
- sdk_version: 2
@@ -187,6 +299,14 @@ neptune_CreateDBInstance:
187299
neptune: {CreateDBInstance}
188300
neptune_CreateDBCluster:
189301
languages:
302+
Python:
303+
versions:
304+
- sdk_version: 3
305+
github: python/example_code/neptune
306+
excerpts:
307+
- description:
308+
snippet_tags:
309+
- neptune.python.create.cluster.main
190310
Java:
191311
versions:
192312
- sdk_version: 2
@@ -200,6 +320,14 @@ neptune_CreateDBCluster:
200320
neptune: {CreateDBCluster}
201321
neptune_CreateDBSubnetGroup:
202322
languages:
323+
Python:
324+
versions:
325+
- sdk_version: 3
326+
github: python/example_code/neptune
327+
excerpts:
328+
- description:
329+
snippet_tags:
330+
- neptune.python.create.subnet.main
203331
Java:
204332
versions:
205333
- sdk_version: 2
@@ -223,6 +351,14 @@ neptune_Scenario:
223351
- Delete the &neptune; Assets.
224352
category: Basics
225353
languages:
354+
Python:
355+
versions:
356+
- sdk_version: 3
357+
github: python/example_code/neptune
358+
excerpts:
359+
- description:
360+
snippet_tags:
361+
- neptune.python.scenario.main
226362
Java:
227363
versions:
228364
- sdk_version: 2
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# Neptune code examples for the SDK for Python
2+
3+
## Overview
4+
5+
Shows how to use the AWS SDK for Python (Boto3) to work with Amazon Neptune.
6+
7+
<!--custom.overview.start-->
8+
<!--custom.overview.end-->
9+
10+
_Neptune is a serverless graph database designed for superior scalability and availability._
11+
12+
## ⚠ Important
13+
14+
* Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/) and [Free Tier](https://aws.amazon.com/free/).
15+
* Running the tests might result in charges to your AWS account.
16+
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
17+
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).
18+
19+
<!--custom.important.start-->
20+
<!--custom.important.end-->
21+
22+
## Code examples
23+
24+
### Prerequisites
25+
26+
For prerequisites, see the [README](../../README.md#Prerequisites) in the `python` folder.
27+
28+
Install the packages required by these examples by running the following in a virtual environment:
29+
30+
```
31+
python -m pip install -r requirements.txt
32+
```
33+
34+
<!--custom.prerequisites.start-->
35+
<!--custom.prerequisites.end-->
36+
37+
### Get started
38+
39+
- [Hello Neptune](HelloNeptune.py#L4) (`DescribeDBClustersPaginator`)
40+
41+
42+
### Basics
43+
44+
Code examples that show you how to perform the essential operations within a service.
45+
46+
- [Learn the basics](NeptuneScenario.py)
47+
48+
49+
### Single actions
50+
51+
Code excerpts that show you how to call individual service functions.
52+
53+
- [CreateDBCluster](NeptuneScenario.py#L288)
54+
- [CreateDBInstance](NeptuneScenario.py#L269)
55+
- [CreateDBSubnetGroup](NeptuneScenario.py#L335)
56+
- [CreateGraph](analytics/CreateNeptuneGraphExample.py#L7)
57+
- [DeleteDBCluster](NeptuneScenario.py#L14)
58+
- [DeleteDBInstance](NeptuneScenario.py#L77)
59+
- [DeleteDBSubnetGroup](NeptuneScenario.py#L95)
60+
- [DescribeDBClusters](NeptuneScenario.py#L203)
61+
- [DescribeDBInstances](NeptuneScenario.py#L242)
62+
- [ExecuteGremlinProfileQuery](database/NeptuneGremlinQueryExample.py#L22)
63+
- [ExecuteGremlinQuery](database/NeptuneGremlinExplainAndProfileExample.py#L8)
64+
- [ExecuteOpenCypherExplainQuery](database/OpenCypherExplainExample.py#L22)
65+
- [ExecuteQuery](analytics/NeptuneAnalyticsQueryExample.py#L7)
66+
- [StartDBCluster](NeptuneScenario.py#L161)
67+
- [StopDBCluster](NeptuneScenario.py#L183)
68+
69+
70+
<!--custom.examples.start-->
71+
<!--custom.examples.end-->
72+
73+
## Run the examples
74+
75+
### Instructions
76+
77+
78+
<!--custom.instructions.start-->
79+
<!--custom.instructions.end-->
80+
81+
#### Hello Neptune
82+
83+
This example shows you how to get started using Neptune.
84+
85+
```
86+
python HelloNeptune.py
87+
```
88+
89+
#### Learn the basics
90+
91+
This example shows you how to do the following:
92+
93+
- Create an Amazon Neptune Subnet Group.
94+
- Create an Neptune Cluster.
95+
- Create an Neptune Instance.
96+
- Check the status of the Neptune Instance.
97+
- Show Neptune cluster details.
98+
- Stop the Neptune cluster.
99+
- Start the Neptune cluster.
100+
- Delete the Neptune Assets.
101+
102+
<!--custom.basic_prereqs.neptune_Scenario.start-->
103+
<!--custom.basic_prereqs.neptune_Scenario.end-->
104+
105+
Start the example by running the following at a command prompt:
106+
107+
```
108+
python NeptuneScenario.py
109+
```
110+
111+
112+
<!--custom.basics.neptune_Scenario.start-->
113+
<!--custom.basics.neptune_Scenario.end-->
114+
115+
116+
### Tests
117+
118+
⚠ Running tests might result in charges to your AWS account.
119+
120+
121+
To find instructions for running these tests, see the [README](../../README.md#Tests)
122+
in the `python` folder.
123+
124+
125+
126+
<!--custom.tests.start-->
127+
<!--custom.tests.end-->
128+
129+
## Additional resources
130+
131+
- [Neptune User Guide](https://docs.aws.amazon.com/neptune/latest/userguide/intro.html)
132+
- [Neptune API Reference](https://docs.aws.amazon.com/neptune/latest/apiref/Welcome.html)
133+
- [SDK for Python Neptune reference](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/iam.html)
134+
135+
<!--custom.resources.start-->
136+
<!--custom.resources.end-->
137+
138+
---
139+
140+
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
141+
142+
SPDX-License-Identifier: Apache-2.0

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /