日本熟妇hd丰满老熟妇,中文字幕一区二区三区在线不卡 ,亚洲成片在线观看,免费女同在线一区二区

MatchAllQuery可以匹配所有行,常用于查詢表中數(shù)據(jù)總行數(shù),或者隨機(jī)返回幾條數(shù)據(jù)。

前提條件

  • 已初始化OTSClient。具體操作,請參見初始化OTSClient
  • 已創(chuàng)建數(shù)據(jù)表并寫入數(shù)據(jù)。
  • 已在數(shù)據(jù)表上創(chuàng)建多元索引。具體操作,請參見創(chuàng)建多元索引

參數(shù)

參數(shù)

描述

query

設(shè)置查詢類型為MatchAllQuery。

table_name

數(shù)據(jù)表名稱。

index_name

多元索引名稱。

limit

本次查詢需要返回的最大數(shù)量。

如果只為了獲取行數(shù),無需獲取具體數(shù)據(jù),可以設(shè)置limit=0,即不返回任意一行數(shù)據(jù)。

get_total_count

是否返回匹配的總行數(shù),默認(rèn)為false,表示不返回。

返回匹配的總行數(shù)會影響查詢性能。

columns_to_get

是否返回所有列。

  • 當(dāng)設(shè)置return_type為ColumnReturnType.SPECIFIED時(shí),可以通過column_names指定返回的列。

  • 當(dāng)設(shè)置return_type為ColumnReturnType.ALL時(shí),表示返回所有列。

  • 當(dāng)設(shè)置return_type為ColumnReturnType.NONE時(shí),表示不返回所有列,只返回主鍵列。

示例

以下示例用于查詢表中數(shù)據(jù)的總行數(shù)。

  • 5.2.1及之后版本

    使用5.2.1及之后的SDK版本時(shí),默認(rèn)的返回結(jié)果為SearchResponse對象,請求示例如下:

    query=MatchAllQuery()
    all_rows=[]
    next_token=None
    first_page=True
    
    while first_page or next_token:
        search_response=client.search(table_name, index_name,
            SearchQuery(query,next_token=next_token,limit=100,get_total_count=True),
            columns_to_get=ColumnsToGet(['k','t','g','ka','la'],ColumnReturnType.SPECIFIED))
        all_rows.extend(search_response.rows)
        first_page=False
    for row in all_rows:
        print(row)
    
    print('Totalrows:', len(all_rows))
    

    如果需要返回Tuple類型結(jié)果,您可以使用如下請求示例實(shí)現(xiàn)。

    query=MatchAllQuery()
    all_rows=[]
    next_token=None
    first_page=True
    
    while first_page or next_token:
        rows, next_token, total_count, is_all_succeed, agg_results, group_by_results =client.search(table_name, index_name,
            SearchQuery(query,next_token=next_token,limit=100,get_total_count=True),
            columns_to_get=ColumnsToGet(['k','t','g','ka','la'],ColumnReturnType.SPECIFIED)).v1_response()
        all_rows.extend(rows)
        first_page=False
    for row in all_rows:
        print(row)
    
    print('Totalrows:', len(all_rows))
    
  • 5.2.1之前版本

    使用5.2.1之前的SDK版本時(shí),默認(rèn)的返回結(jié)果為Tuple類型,請求示例如下:

    query=MatchAllQuery()
    all_rows=[]
    next_token=None
    first_page=True
    while first_page or next_token:
        rows, next_token, total_count, is_all_succeed = client.search(table_name, index_name,
            SearchQuery(query, next_token=next_token, limit=100, get_total_count=True),
            columns_to_get=ColumnsToGet(['k', 't', 'g', 'ka', 'la'], ColumnReturnType.SPECIFIED))
        all_rows.extend(rows)
        first_page=False
    for row in all_rows:
        print(row)
    
    print('Total rows:', len(all_rows))