Skip to content

Examples

Index > Neptune > Examples

Auto-generated documentation for Neptune type annotations stubs module types-aiobotocore-neptune.

Client

Implicit type annotations

Can be used with types-aioboto3[neptune] package installed.

Write your Neptune code as usual, type checking and code completion should work out of the box.

Client usage example
from aioboto3.session import Session


session = Session()

async with session.client("neptune") as client:  # (1)
    result = await client.add_role_to_db_cluster()  # (2)
  1. client: NeptuneClient
  2. result: EmptyResponseMetadataTypeDef
Paginator usage example
from aioboto3.session import Session


session = Session()

async with session.client("neptune") as client:  # (1)
    paginator = client.get_paginator("describe_db_cluster_endpoints")  # (2)
    async for item in paginator.paginate(...):
        print(item)  # (3)
  1. client: NeptuneClient
  2. paginator: DescribeDBClusterEndpointsPaginator
  3. item: DBClusterEndpointMessageTypeDef
Waiter usage example
from aioboto3.session import Session


session = Session()

async with session.client("neptune") as client:  # (1)
    waiter = client.get_waiter("db_instance_available")  # (2)
    await waiter.wait()
  1. client: NeptuneClient
  2. waiter: DBInstanceAvailableWaiter

Explicit type annotations

With types-aioboto3-lite[neptune] or a standalone types_aiobotocore_neptune package, you have to explicitly specify client: NeptuneClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

Client usage example
from aioboto3.session import Session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.type_defs import EmptyResponseMetadataTypeDef
from types_aiobotocore_neptune.type_defs import AddRoleToDBClusterMessageRequestTypeDef


session = Session()

client: NeptuneClient
async with session.client("neptune") as client:  # (1)
    kwargs: AddRoleToDBClusterMessageRequestTypeDef = {...}  # (2)
    result: EmptyResponseMetadataTypeDef = await client.add_role_to_db_cluster(**kwargs)  # (3)
  1. client: NeptuneClient
  2. kwargs: AddRoleToDBClusterMessageRequestTypeDef
  3. result: EmptyResponseMetadataTypeDef
Paginator usage example
from aioboto3.session import Session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.paginator import DescribeDBClusterEndpointsPaginator
from types_aiobotocore_neptune.type_defs import DBClusterEndpointMessageTypeDef


session = Session()

client: NeptuneClient
async with session.client("neptune") as client:  # (1)
    paginator: DescribeDBClusterEndpointsPaginator = client.get_paginator("describe_db_cluster_endpoints")  # (2)
    async for item in paginator.paginate(...):
        item: DBClusterEndpointMessageTypeDef
        print(item)  # (3)
  1. client: NeptuneClient
  2. paginator: DescribeDBClusterEndpointsPaginator
  3. item: DBClusterEndpointMessageTypeDef
Waiter usage example
from aioboto3.session import Session

from types_aiobotocore_neptune.client import NeptuneClient
from types_aiobotocore_neptune.waiter import DBInstanceAvailableWaiter


session = Session()

async with session.client("neptune") as client:  # (1)
    waiter = client.get_waiter("db_instance_available")  # (2)
    await waiter.wait()
  1. client: NeptuneClient
  2. waiter: DBInstanceAvailableWaiter