async def sample_delete_session():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.DeleteSessionRequest(
        name="name_value",
    )

    # Make the request
    await client.delete_session(request=request)
async def sample_begin_transaction():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.BeginTransactionRequest(session="session_value", )

    # Make the request
    response = await client.begin_transaction(request=request)

    # Handle the response
    print(response)
async def sample_rollback():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.RollbackRequest(
        session="session_value",
        transaction_id=b'transaction_id_blob',
    )

    # Make the request
    await client.rollback(request=request)
async def sample_get_session():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.GetSessionRequest(name="name_value", )

    # Make the request
    response = await client.get_session(request=request)

    # Handle the response
    print(response)
async def sample_create_session():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.CreateSessionRequest(database="database_value", )

    # Make the request
    response = await client.create_session(request=request)

    # Handle the response
    print(response)
async def sample_list_sessions():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.ListSessionsRequest(database="database_value", )

    # Make the request
    page_result = client.list_sessions(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
async def sample_batch_create_sessions():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.BatchCreateSessionsRequest(
        database="database_value",
        session_count=1420,
    )

    # Make the request
    response = await client.batch_create_sessions(request=request)

    # Handle the response
    print(response)
async def sample_commit():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.CommitRequest(
        transaction_id=b'transaction_id_blob',
        session="session_value",
    )

    # Make the request
    response = await client.commit(request=request)

    # Handle the response
    print(response)
async def sample_execute_sql():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.ExecuteSqlRequest(
        session="session_value",
        sql="sql_value",
    )

    # Make the request
    response = await client.execute_sql(request=request)

    # Handle the response
    print(response)
async def sample_partition_query():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.PartitionQueryRequest(
        session="session_value",
        sql="sql_value",
    )

    # Make the request
    response = await client.partition_query(request=request)

    # Handle the response
    print(response)
示例#11
0
async def sample_partition_read():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.PartitionReadRequest(
        session="session_value",
        table="table_value",
    )

    # Make the request
    response = await client.partition_read(request=request)

    # Handle the response
    print(response)
示例#12
0
async def sample_read():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    request = spanner_v1.ReadRequest(
        session="session_value",
        table="table_value",
        columns=['columns_value_1', 'columns_value_2'],
    )

    # Make the request
    response = await client.read(request=request)

    # Handle the response
    print(response)
示例#13
0
async def sample_execute_batch_dml():
    # Create a client
    client = spanner_v1.SpannerAsyncClient()

    # Initialize request argument(s)
    statements = spanner_v1.Statement()
    statements.sql = "sql_value"

    request = spanner_v1.ExecuteBatchDmlRequest(
        session="session_value",
        statements=statements,
        seqno=550,
    )

    # Make the request
    response = await client.execute_batch_dml(request=request)

    # Handle the response
    print(response)