Example #1
0
def sample_delete_session():
    # Create a client
    client = spanner_v1.SpannerClient()

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

    # Make the request
    client.delete_session(request=request)
def sample_get_session():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

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

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

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

    # Handle the response
    print(response)
Example #4
0
def sample_begin_transaction():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

    # Handle the response
    print(response)
Example #5
0
def sample_rollback():
    # Create a client
    client = spanner_v1.SpannerClient()

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

    # Make the request
    client.rollback(request=request)
Example #6
0
def sample_execute_sql():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

    # Handle the response
    print(response)
Example #7
0
def sample_partition_read():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

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

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

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

    # Handle the response
    print(response)
Example #9
0
def sample_batch_create_sessions():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

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

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

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

    # Handle the response
    print(response)
Example #11
0
def sample_list_sessions():
    # Create a client
    client = spanner_v1.SpannerClient()

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

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

    # Handle the response
    for response in page_result:
        print(response)
def sample_read():
    # Create a client
    client = spanner_v1.SpannerClient()

    # 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 = client.read(request=request)

    # Handle the response
    print(response)
def sample_execute_batch_dml():
    # Create a client
    client = spanner_v1.SpannerClient()

    # 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 = client.execute_batch_dml(request=request)

    # Handle the response
    print(response)